English 中文(简体)
I18n. Locale inrails
原标题:I18n.locale in rails

我正在成功地把I18n. locale摆在我的肩上,但当我想要利用它时,问题就会出现:

 @categories = Category.where(:tld => I18n.locale).all 

当时,我正在经历奇怪的 condition状:

 SELECT "categories".* FROM "categories" WHERE ("categories"."tld" =  --- :com )

however when I do logger.info(I18n.locale) I am getting correct output:

  com

我是新的铁路和废墟,我看不到I18n. locale的坚固价值。

问题回答

我发现简单明了的解决办法:

 I18n.locale.to_s

是否有更简单的方法?

在全球范围扩展方面,我面临各种问题。 我现在要补充一下,在那些为寻找工作创造条件的地方。

I18n.locale.to_s

我的工作





相关问题
How does gettext handle dynamic content?

In php (or maybe gettext in general), what does gettext do when it sees a variable to dynamic content? I have 2 cases in mind. 1) Let s say I have <?=$user1?> poked John <?=$user2?>. ...

Explain the Need for Mutexes in Locales, Please

Reading the question Why doesn’t C++ STL support atoi(const string& ) like functions?, I encountered a comment which warned that GCC (at least) has a bug that can slow down multi-threaded ...

How does Vistalizer work

How does Vistalizer manage to override the language limit in Windows Vista Home edition. Which api s does it use to allow installation of Multiple language packages.

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...

Rails Globalize plugin help

Has anyone gotten the Globalize plugin to work Rails 2.3.2 or later? If so, could you direct me to some useful info?

热门标签