Dspace1.5 之 I18N

 

      Dspace1.5有着对国际化的良好支持。 下面对dspace中国际化的结构进行简单说明,同时对应用简体中文时所遇到的问题给出我的解决办法。

 

 

1.    在dspace-jspui/dspace-jspui-webapp工程中,web.xml里定义的资源文件片段如下:

 

  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>Messages</param-value>
  </context-param>

 

可以看到,资源文件的基本名称是“Messages”。

 

2.    语言包 dspace-api-lang-1.5.0.0.jar 位于dspace-jspui\dspace-jspui-webapp\target\dspace-jspui-webapp-1.5.1-SNAPSHOT\WEB-INF\lib\ 目录下,里面包括多种语言的资源文件:

 

 

 

 

3.    在安装目录的配置文件中D:\dspace\config\dspace.cfg中来设置支持语言的种类:

 

# All the Locales, that are supported by this instance of DSpace
# A comma seperated list of Locales. All types of Locales country, country_language, country_language_variant
# Note that the appropriate file are present, especially that all the Messages_x.properties are there
# may be used, e. g: webui.supported.locales = en, de
webui.supported.locales = zh_CN,en,de,hu,ja,fr

 webui.supported.locales 中按照命名规则可以任意设定所支持的语言,这里设定六种。

  

4.  可是唯独 zh_CN 简体中文出不来,找到解决办法如下:

 

       

        1)     将dspace-api-lang-1.5.0.0.jar 包中的 Messages_zh_TW.properties 转换成中文汉字(繁体)。

                 参考 JDK自带的native2ascii工具完全解密

 

native2ascii -reverse Messages_zh_TW.properties temp.properties

 

        2)     下载软件“中文简体繁体转换王”,将temp.properties文件由繁体转换为简体;

 

        3)     将转换后的简体文件通过native2ascii工具转换为ascii编码文件 Messages_zh_CN.properties;

 

native2ascii  temp.properties Messages_zh_CN.properties

 

        4)     将Messages_zh_CN.properties文件放到 dspace-api\src\main\resources 目录下;

 

 

        4)     运行dspace-assemble重新编译一下,运行ok!

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值