在rails3 中使用 i18n来做国际化处理
来源:互联网 发布:修理厂软件 编辑:程序博客网 时间:2024/06/06 10:59
1. 访问 rails i18n 插件的官方网站 ,查看信息
http://guides.rubyonrails.org/i18n.html
2. 在Gemfile 中加入
gem 'rails-i18n'
3. 使用bundle install 来安装
4. 配置 config/application.rb
# config/application.rb config.i18n.load_path += Dir[Rails.root.join('config','locales','**','*.{rb,yml}')] config.i18n.default_locale = :'zh-CN'
5.创建model的中文信息
增加 中文配置文件 /config/locales/models/dps/zh_CN.yml
其中 dps是model的名字
zh_CN.yml的内容如下:
zh-CN: activerecord: models: dps: '数据处理系统' attributes: dps: sys_id: '系统编号' description : '系统描述' pulse: '系统脉搏' last_received: '最后一次接受记录数' last_received_time: '最后一次接受数据时间' amount: '接受记录总数'
6.在需要调用显示的地方使用如下语句
<%= Dps.human_attribute_name :sys_id %>
- 在rails3 中使用 i18n来做国际化处理
- 在struts中使用国际化(i18n)
- 在struts中完美的使用i18n-国际化原来如此简单
- 在struts2.0中国际化(i18n)应用程序
- struts2中I18N国际化
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- 在Struts 2.0中国际化(i18n)您的应用程序
- alter table move跟shrink space的区别
- Android跑马灯效果
- 深入理解拉格朗日乘子法(Lagrange Multiplier) 和KKT条件
- qwt开发 1 unresolved externals
- linux 下 erlang的安装
- 在rails3 中使用 i18n来做国际化处理
- 好东西,先收着再说
- SPFolder的使用 sharepoint 自定义 添加文件夹
- 在IE6中,Frame和 IFrame中无法按常规方法来读写cookies。
- jni中GB2312中文编码在Java中显示
- java synchronized详解
- android Vibrator 使用
- 调用MessageUI框架实现收送邮件
- FileReference URLrequest上传文件的问题:Session丢失