gpt4 book ai didi

grails - 如何处理Grails i18n文本中的样式?

转载 作者:行者123 更新时间:2023-12-02 14:42:36 25 4
gpt4 key购买 nike

我正在对Grails(2.4.2)应用程序进行国际化,但偶然发现了一个我以前没有考虑过的用例。我需要转:

<p>The quick <b>brown fox jumps</b> over the fence.</p>

进入:
<p><g:message code="example.text" /></p>

但是,正如您所看到的,这句话的中间是 <b>...</b>标记形式的HTML样式/格式。我以前从未遇到过这个问题,我有些困惑。在我看来,格式/样式说明不属于i18n属性文件,例如:
# messages.properties
example.text=The quick <b>brown fox jumps</b> over the fence.

因此,我现在看起来很丑陋:
<p><g:message code="example.text.1" /> <b><g:message code="example.text.2" /></b> <g:message code="example.text.3" />.</p>

和:
# messages.properties
example.text.1=The quick
example.text.2=brown fox jumps
example.text.3=over the fence.

但这感觉很愚蠢。所以我问: 在i18n文本中处理样式的Grails方法是什么?

最佳答案

不用担心对于简单的文本强调(粗体,斜体,下划线),最好将必要的html代码放在i18n属性文件中。

关于grails - 如何处理Grails i18n文本中的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27029858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com