道喜技术日记 .^. 天天红玉世界

Rails Ruby MacOSX 。。。创新来自于刻苦的实践和勤奋的思考... www.hhtong.com


Rails2.2世界:国际化功能问与答(四)

Gudao Luo2008-12-13 at 10:04发表的

国际化功能问与答(四)
  • 本地化问题(四):本地化工作方法
    • 重新载入本地化文件命令:
      I18n.reload!
    • 设置当前本地化语言
      I18n.locale = “zh-CN”
    • 查看当前本地化语言
      I18n.locale
    • 查看本地化内容信息
      I18n.t “time.formats”
    • 简化本地化函数方法
简化本地化函数方法
class String
def t(locale="zh-CN")
I18n.t self.to_sym, :locale => locale
end
end
"hello".t
"hello".t "en"
Hierarchy: previous, next

Comments

There are 0 comments on this post. Post yours →

Post a comment

Required fields in bold.