0%

rails 多语言支持

http://railscasts.com/episodes/138-i18n
http://rails-i18n.org/
Locale Examples
http://blog.segmentfault.com/xiongxin/1190000000489534

###i18n.rb:

1
2
3
4
5
I18n.default_locale = 'zh-CN'
LANGUAGES = {
'English' => 'en',
'Chinese' => 'zh-CN'
}

###application.rb:

1
2
3
I18n.config.enforce_available_locales = false
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :'zh-CN'

kaminari 多语设置

###zh-CN.yml:

1
2
3
4
5
6
7
8
zh-CN:
views:
pagination:
first: "« 首页"
last: "末页 »"
previous: "« 上一页"
next: "下一页 »"
truncate: "..."