2012-01-15 60 views
3

我使用这个链接把登​​录链接在我的应用程序:翻译制订登录链接

https://github.com/plataformatec/devise/wiki/How-To:-Add-sign_in,-sign_out,-and-sign_up-links-to-your-layout-template 

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

https://gist.github.com/871074 

请问轨使用法国默认:

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 

但对于我的按钮/标签不译:

<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div> 

它写的“记住我”,但我想法语翻译。

我做错了什么?

谢谢

回答

10

在轨道3,你会需要它的结构如下:

fr: 
    helpers: 
    label: 
     user: 
     remember_me: French text here! 

blog postthis one应该是有帮助的。

6

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

fr: 
    activerecord: 
    attributes: 
     user: 
     remember_me: text