alchemy_cms
https://github.com/magiclabs/alchemy_cms
Ruby
AlchemyCMS is a powerful, flexible and user centric Rails 5 CMS. 🧙🏻♂️
Alchemy::I18n.translate
Alchemy translation methods
Instead of having to translate strings and defining a default value:
Alchemy::I18n.translate("Hello World!", default: 'Hello World!')
We define this method to define the value only once:
Alchemy::I18n.translate("Hello World!")
Note that interpolation still works:
Alchemy::I18n.translate("Hello %{world}!", world: @world)
=== Notes
All translations are scoped into the +alchemy+ namespace.
Even scopes are scoped into the +alchemy+ namespace.
So a call for Alchemy::translate('hello', scope: 'world') has to be translated like this:
de:
alchemy:
world:
hello: HalloEdit
git clone [email protected]:magiclabs/alchemy_cms.git
cd alchemy_cms
open lib/alchemy/i18n.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Alchemy--I18n-translate-for-pr
# Commit to gitgit add lib/alchemy/i18n.rbgit commit -m "better docs for Alchemy::I18n.translate"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Alchemy--I18n-translate-for-pr
hub pull-request
# Celebrate!