https://github.com/onthegosystems/clean_localization
https://github.com/onthegosystems/clean_localization
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/onthegosystems/clean_localization
- Owner: OnTheGoSystems
- Created: 2019-08-21T07:03:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-26T10:39:57.000Z (about 2 years ago)
- Last Synced: 2025-04-21T16:53:01.412Z (3 months ago)
- Language: Ruby
- Size: 93.8 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CleanLocalization
## Simple and minimalistic Ruby localization# Translation resource example (main.yml)
```yaml
user:
name:
en: User name
uk: Im`я користувача
header:
title:
en: "Hi %{name}!"
uk: "Вітаю %{name}!"
```# Usage example
```ruby
# Define resources path
CleanLocalization::Config.base_path = Pathname("#{path}/resources")# Use client
CleanLocalization::Client.new('fr').translate("user.name")
# => "User name"
CleanLocalization::Client.new('uk').translate("user.name")
# => "Im`я користувача"CleanLocalization::Client.new('uk').translate("header.title", name: "John Snow")
# => "Вітаю John Snow!"CleanLocalization::Client.new('en').translate("header.title", name: "John Snow")
# => "Hi John Snow!"```