翻译设计登录链接

Seb*_*ien 3 ruby-on-rails devise ruby-on-rails-3

我使用此链接将登录链接放在我的应用程序上:

https://github.com/plataformatec/devise/wiki/How-To:-Add-sign_in,-sign_out,-and-sign_up-links-to-your-layout-template
Run Code Online (Sandbox Code Playgroud)

我还为法语添加了一个翻译文件:

https://gist.github.com/871074
Run Code Online (Sandbox Code Playgroud)

我要求rails使用french作为默认值:

 config.before_configuration do
   I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
   I18n.locale = :fr
   I18n.default_locale = :fr
   config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
   config.i18n.locale = :fr
   # bypasses rails bug with i18n in production\
   I18n.reload!
   config.i18n.reload!
end

config.i18n.locale = :fr
config.i18n.default_locale = :fr
Run Code Online (Sandbox Code Playgroud)

但是我的按钮/标签没有翻译:

<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
Run Code Online (Sandbox Code Playgroud)

它写"记住我",但我想要法语翻译.

我做错了什么?

谢谢

Gaz*_*ler 10

在rails 3中,您将需要以下结构:

fr:
  helpers:
    label:
      user:
        remember_me: French text here!
Run Code Online (Sandbox Code Playgroud)

这篇博文这篇博文应该会有所帮助.


小智 6

此外,您还可以添加以下行:

fr:
  activerecord:
    attributes:
      user:
        remember_me: text
Run Code Online (Sandbox Code Playgroud)