English 中文(简体)
为什么要把我的铁路拖到服务器上的错误信息上。
原标题:Why doesn t my Rails app pick up translations for error messages on the server

我有一个铁路3.2.3站点,在Ruby 1.9.2. 我将铁路-i18ngem用于翻译,并将国际化环境纳入荷兰翻译:

config.i18n.available_locales = :nl
config.i18n.default_locale = :nl

我也把翻译文件添加到我的地方地图上,这甚至是必要的。

When I run the site locally, in development or production mode, all translations are handled correctly, including error messages. However, when I deploy the site to my server (hosted on Webfaction, using nginx), it doesn t use the translations for error messages; they remain to be displayed in English.

我确实重新启用了服务器,我确实做了 pre事,我只是从服务器上提取了光顾,而我是“探索”。

Is there anything else I should do in order to make the site use the Dutch translations for erros?

最佳回答

根据要求,我对这个问题的评论:

Silly question, and I know you say you ve had it working in production mode locally, but what file is config.i18n.available_locales = :nl etc in? In configenvironmentsdevelopment.rb? Is it also in configenvironmentsproduction.rb?

常常很容易忘记,你在一种环境中,而不是在另一种环境中选择。

问题回答

The rails-i18n gem includes its own translation files - is it possible that your production environment isn t using the same gemset?

在这种情况下,解决办法是制作服务器上<编码>undle Update。

Alternatively you can either

  • http://github.com/svenfuchs/rails-i18n/blob/master/rails/ locale/nl.yml”rel=“nofollow”https://github.com/svenfuchs/rails-i18n/blob/master/rails/ locale/nl.yml

  • 利用 当地等内容管理您的翻译属性。





相关问题
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?

热门标签