rails4自带国际化
在application.rb中添加
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
config.i18n.available_locales = [:en, :cn]
config.i18n.default_locale = 'cn'
然后无需做其他操作,yml的格式一定要整对就OK了
active_admin.cn.yml实例,行前是2空格,切勿用table
cn:
active_admin:
dashboard: "控制面板"
dashboard_welcome:
welcome: "欢迎使用Active Admin. 这是默认的控制面板页."
call_to_action: "若要添加新的面板内容, 请修改 'app/admin/dashboard.rb'"
view: "查看"
edit: "编辑"
delete: "删除"
delete_confirmation: "确定删除?"
new_model: "新建%{model}"
create_model: "新建%{model}"
edit_model: "编辑%{model}"
update_model: "编辑%{model}"
delete_model: "删除%{model}"
details: "%{model}详情"
cancel: "取消"
empty: "清空"
previous: "上一个"
next: "下一个"
download: "下载:"
has_many_new: "新建一个%{model}"
has_many_delete: "删除"
has_many_remove: "清除"
filters:
buttons:
filter: "过滤"
clear: "清除条件"
predicates:
contains: "包含"
equals: "等于"
starts_with: "开头"
ends_with: "完与"
greater_than: "大于"
less_than: "小于"
main_content: "请执行 %{model}#main_content 来显示内容."
logout: "退出"
powered_by: "Powered by %{active_admin} %{version}"
sidebars:
filters: "所有条件"
pagination:
empty: "暂时没有%{model}"
one: "显示 <b>1</b> %{model}"
one_page: "显示 <b>所有 %{n}</b> %{model}"
multiple: "显示所有 <b>%{total}</b> %{model}中的<b>%{from} - %{to}</b> 条"
multiple_without_total: "%{model}中的<b>%{from} - %{to}</b> 条"
entry:
one: "条目"
other: "条目"
any: "任何"
blank_slate:
content: "暂时还没有%{resource_name}."
link: "新建一个"
batch_actions:
button_label: "批处理"
default_confirmation: "你确定你要这样做?"
delete_confirmation: "你确定要删除所有%{plural_model}?"
succesfully_destroyed:
one: "成功删除 1 %{model}"
other: "成功删除 %{count} %{plural_model}"
selection_toggle_explanation: "(切换选择)"
link: "新建一个"
action_label: "%{title} 被选中"
labels:
destroy: "删除"
comments:
body: "内容"
author: "作者"
title: "评论"
add: "添加评论"
resource: "资源"
no_comments_yet: "暂时没有评论"
title_content: "(%{count})条评论"
errors:
empty_text: "评论保存失败,内空不能为空."
devise:
username:
title: "用户名"
email:
title: "邮箱"
subdomain:
title: "子域"
password:
title: "密码"
login:
title: "登录"
remember_me: "记住我"
submit: "登录"
reset_password:
title: "忘记了密码?"
submit: "重置我的密码"
unlock:
title: "重新发送送解锁命令"
submit: "重新发送送解锁命令"
links:
sign_in: "登录"
forgot_your_password: "忘记了密码?"
sign_in_with_omniauth_provider: "登入%{provider}"
access_denied:
message: "您无权处理此操作"
formtastic:
yes: "YES"
no: "NO"
create: "新建%{model}"
update: "更新%{model}"
submit: "确认"
cancel: "取消"
reset: "重置%{model}"
required: "必须的"
devise.cn.yml
cn:
devise:
confirmations:
confirmed: "您的帐号已经确认,您现在已登录。"
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。"
failure:
already_authenticated: "您已经登录。"
inactive: "您还没有激活帐户。"
invalid: "邮箱或密码错误。"
locked: "您的帐号已被锁定。"
last_attempt: "您还有最后一次尝试机会,再次失败您的账号将被锁定。"
not_found_in_database: "邮箱或密码错误。"
timeout: "您已登录超时,请重新登录。"
unauthenticated: "继续操作前请注册或者登录。"
unconfirmed: "继续操作前请先确认您的帐号。"
mailer:
confirmation_instructions:
subject: "确认信息"
reset_password_instructions:
subject: "重置密码信息"
unlock_instructions:
subject: "解锁信息"
omniauth_callbacks:
failure: "因为%{reason},所以您无法从%{kind}获得授权。"
success: "成功地从%{kind}获得授权。"
passwords:
no_token: "这是密码重置页面,未重置邮件不得访问此页面。如果您是通过重置邮件而来的,请确保您访问的URL是完整的。"
send_instructions: "几分钟后,您将收到重置密码的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封找回密码的邮件。"
updated: "您的密码已修改成功,您现在已登录。"
updated_not_active: "您的密码已修改成功。"
registrations:
destroyed: "再见!您的帐户已成功注销。我们希望很快可以再见到您。"
signed_up: "欢迎您!您已注册成功。"
signed_up_but_inactive: "您已注册,但尚未激活账号。"
signed_up_but_locked: "您已注册,但账号被锁定了。"
signed_up_but_unconfirmed: "一封带有确认链接的邮件已经发送至您的邮箱,请检查邮箱(包括垃圾邮箱),并点击该链接激活您的账号。"
update_needs_confirmation: "信息更新成功,但我们需要染整您的新电子邮件地址,请检查邮箱(包括垃圾邮箱),并点击该链接激活您的账号。"
updated: "帐号资料更新成功。"
sessions:
signed_in: "登录成功."
signed_out: "退出成功."
unlocks:
send_instructions: "几分钟后,您将收到一封解锁帐号的邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封解锁账号的邮件。"
unlocked: "您的帐号已成功解锁,您现在已登录。"
errors:
messages:
already_confirmed: "已经确认,请重新登录。"
confirmation_period_expired: "请在%{period}内确认注册, 请重新注册。"
expired: "邮件确认已过期,请重新注册。"
not_found: "没有找到。"
not_locked: "未锁定。"
not_saved:
one: "因为1个错误导致此%{resource}保存失败:"
other: "因为%{count}个错误导致此%{resource}保存失败:"