GWT i18n消息属性不显示像ß这样的特殊字符 [英] GWT i18n Message Properties does not Display special Character like ß
问题描述
我使用GWT i18n 信息翻译消息:
@DefaultLocale(en)
公共接口消息扩展了com.google.gwt。 i18n.client.Messages {
@DefaultMessage(Size)
String size();
$ / code>
对于德语我有 Messages_de .properties
档案。
size =GrößeäÖöÄÖÜ
在我的一个UIBinder模板中,我使用
< ui:text with ={messages.size}/>
当用户的浏览器是 de
时,显示GrößeäüöÄÜÜ
。
我的工作空间和我的.properties文件设置为UTF8。
我怎样才能在德文显示正确的特殊字符ß
还是有办法包含ASCII码?
<解决方案:当你设置CSS text-transform:uppercase;
,那么 SS
。
这是Eclipse处理属性
文件。您可以将整个工作区设置为UTF-8,但仍然会将属性
文件视为 ISO 8859-1
- 因为这是默认/预期编码。但是,GWT使用增强的属性文件格式,它使用UTF-8直接(不需要转义字符)。
您必须单独覆盖此设置:
< img src =https://i.stack.imgur.com/wUQc7.pngalt =在Eclipse中设置属性文件的编码>
您可以更改(不要忘记点击 *。properties
文件到 UTF-8
c $ c> Update 按钮)。
但请注意,这意味着将所有属性
文件为UTF-8 。因此,除非您确定这不会破坏任何内容,否则我会将文件关联缩小到 * Messages.properties
文件(如果所有翻译文件都有消息
后缀)。或者只是使用其他编辑器来编辑属性文件。
I use GWT i18n Messages to translate messages:
@DefaultLocale("en")
public interface Messages extends com.google.gwt.i18n.client.Messages {
@DefaultMessage("Size")
String size();
}
For German I have the Messages_de.properties
file.
size=Größe äüö ÄÖÜ
In one of my UIBinder templates I use
<ui:text with="{messages.size}"/>
When the user's browser is de
I get Grösse ÄÖÜ ÄÖÜ
instead of Größe äüö ÄÖÜ
being displayed.
My workspace as well as my .properties file is set to UTF8.
How can I get the special character ß
in German being displayed correctly or is there a way to include ASCII code?
Solution: When you set CSS text-transform: uppercase;
then ß
is transformed to SS
.
This is a problem with the way Eclipse handles properties
files. You can set the whole workspace to UTF-8, it will still treat properties
files as ISO 8859-1
- because that's the default/expected encoding. However, GWT uses an enhanced properties file format that uses UTF-8 directly (without the need for escaping the characters).
You have to override this setting separately:
You can change the default encoding for all *.properties
files to UTF-8
there (don't forget to hit the Update
button).
But please note that this will mean treating all properties
files as UTF-8. So unless you are sure this will not break anything, I'd narrow down the file association for example to *Messages.properties
files (if all your translation files have the Messages
suffix). Or just use a different editor for editing the properties files.
这篇关于GWT i18n消息属性不显示像ß这样的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!