翻译Devise登录链接 [英] Translate Devise Login links
本文介绍了翻译Devise登录链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此链接将登录链接放在我的应用程序上:
I use this link to put the login links on my application :
https://github.com/plataformatec/devise/wiki/How-To:-Add-sign_in,-sign_out,-and-sign_up-links-to-your-layout-template
我还为法语添加了一个翻译文件:
I also add a translation file for french :
https://gist.github.com/871074
我要求rails使用法语作为默认值:
And i ask rails to use french as default :
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
但是我的按钮/标签未翻译:
But for my buttons/labels are not translated :
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
它写记住我,但我想要法语翻译。
It write "Remember me" but i want the french translation.
我做错了什么?
谢谢
推荐答案
在rails 3中,您将需要以下结构:
In rails 3, you will need it in the following structure:
fr:
helpers:
label:
user:
remember_me: French text here!
This blog post and this one should be helpful.
这篇关于翻译Devise登录链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文