I am aware of how i18n/l10n is usually done in Rails3, and I chose to have a single ERB file that calls t(...)
for localization. But for a particular part I need something special:
I need to display a string whose localization is coming from an external database.
So how can I know the current language, to call the external database with an en
or ja
parameter?
Something like $LANG in UNIX. Preferably accessible from view or controller.
The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.
Internationalization (i18n) is the process of preparing software so that it can support local languages and cultural settings. An internationalized product supports the requirements of local markets around the world, functioning more appropriately based on local norms and better meeting in-country user expectations.
I18n::InvalidLocale: :en is not a valid locale. Bookmark this question.
Internationalization (i18n) is the process of developing products in such a way that they can be localized for languages and cultures easily. Localization (l10n), is the process of adapting applications and text to enable their usability in a particular cultural or linguistic market.
I18n.locale # Get and set the current locale
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With