在一页上以不同的语言环境显示文本 [英] Displaying text in differnt locales on one page
本文介绍了在一页上以不同的语言环境显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在GSP中以不同的语言显示句子.
I need to display sentences in my GSP in differnt locales.
以下文档指出g:message具有语言环境参数.
The following documentation states that g:message takes a locale param.
我在任何地方都找不到这样的例子.有人做过吗?
I can't find an example of this anywhere. Has anyone done this?
<p><g:message code="welcome.into.text1" locale="sv_SE"/></p>
<p><g:message code="welcome.into.text1" locale="en_US"/></p>
很显然,我有messages_sv.properties& messages_zh_CN.properties.
Obviosuly, I have messages_sv.properties & messages_en_US.properties.
谢谢
推荐答案
要明确指定语言环境,请使用Locale对象而不是String,例如:
To specify locale explicitely use Locale object instead of String, e.g.:
<g:message code="welcome.into.text1" locale="${Locale.US}"/>
这篇关于在一页上以不同的语言环境显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文