美文网首页
如何在spring中实现国际化?

如何在spring中实现国际化?

作者: null_14ee | 来源:发表于2019-06-05 18:43 被阅读0次

如何在spring中实现国际化?

在applicationContext.xml加载一个bean

<bean id=”messageSource” class=”org.springframework.context.support.ResourceBundleMessageSource”>

   <property name=”basename”>

    <value>message</value>

   </property>

</bean>

?在src目录下建多个properties文件

?对于非英文的要用native2ascii -encoding gb2312源目转化文件相关内容

?其命名格式是message_语言_国家。

?页面中的中显示提示信息,键名取键值。

?当给定国家,系统会自动加载对应的国家的properties信息。

?通过applictionContext.getMessage(“键名”,”参数”,”区域”)取出相关的信息。

相关文章

网友评论

      本文标题:如何在spring中实现国际化?

      本文链接:https://www.haomeiwen.com/subject/ppnlxctx.html