开发者

How to set up i18n for different languages?

I am working in internationalization. Can anybody help me how to set up for support different char types?? At least Spanish and German.

I am using Rich faces, this is my configurationfile faces-config.xml

 <application>
        <locale-config>
            <default-locale>en</default-locale>
            <supported-locale>fr</supported-locale>
            <supported-locale>de</supported-locale>
            <supported-locale>es</supported-locale>
        </locale-config>
        <resource-bundle>
            <base-name>messages.Messages</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>

In the pages .xhtml I load the bundle

<f:loadBundle basename="messages.Messages" var="msg1"/>  

and also load the charset:

<meta  charset="utf开发者_如何学运维-8" />

Where must I include needed unicode? Thansk in advance


Java comes bundled with native2ascii tool than you can use to convert from language specific text to latin 1. All you need to do is create a 3 different properties files for French, German and Spanish and then give it to the tool and it will escape the special characters accordingly.

Find more information on the tool here: http://download.oracle.com/javase/1.4.2/docs/tooldocs/windows/native2ascii.html


What I finally did was changing char by char to uniicode.
But I am sure, it must be another way. I someone knows, please, let me know!
What I use is:

SPANISH
á -> \u00E1
é -> \u00E9
í -> \u00ED
ó -> \u00F3
\u00FA -> \u00FA
ñ -> \u00F1

GERMAN
ü -> \u00FC
ö -> \u00F5
ä -> \u00E4
ß -> \u00DF


I use an eclipse plugin for i18n. I just type the text with the normal characters and when you save, the plugin converts them to UTF-8.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜