开发者

Rails i18n: How to know what is the current language?

开发者 https://www.devze.com 2023-03-21 09:04 出处:网络
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 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 e开发者_运维技巧n or ja parameter?

Something like $LANG in UNIX. Preferably accessible from view or controller.


I18n.locale # Get and set the current locale
0

精彩评论

暂无评论...
验证码 换一张
取 消