• Welcome to KonaKart Community Forum. Please login or sign up.
 

question about internationalization for Asian languages

Started by BruceLee, September 28, 2007, 11:29:10 pm

Previous topic - Next topic

BruceLee

Sorry I don't fully catch it from the faq and  couldn't see much posts in forum either.
The Asian (eg Japanese and Chinese) characters in database are OK. But we cannot make it to work on UI.
What we did,
1) Copy Messages.properties to Messages_zh.properties,
and change header.my.account to some Chinese characters
2) Add lines in struts-config.xml
         <action path="/SetLocale_zh_CN" type=" com.konakart.actions.SetLocaleA
ction" parameter="zh_CN">
            <forward name="SetLocale" path="/CatalogMainPage.do"/>
        </action>
3) On web browser I type
localhost:8780/konakart/SetLocale_zh_CN.do
4) But on main page, 'my account' displays wrong characters.
We also tried use existing de_DE and changed header.my.account to some Chinese characters. But it doesn't display correctly either.

Have we done correct steps? An step-by-step faq for this is highly appreciated.
-Bruce

paolo

Hi Bruce,

I think that the piece that you are missing is the following:

Java programs can process only those files that are encoded in Latin-1 (ISO
8859-1) encoding or files in Unicode encoding. Any other files containing
different encodings besides these two will not be processed. The
native2ascii tool is used to convert such non Latin-1 or non-Unicode files
into a Unicode encoded file. Any characters that are not in ISO 8859-1 will be
encoded using Unicode escapes. For example, if you have a file encoded in a
different language, say myCyrillicFile in Cyrillic, you can use the native2ascii
tool to convert it into a Unicode encoded file as follows:

native2ascii -encoding UTF-8 myCyrillicFile myUnicodeFile

You can use other encodings besides UTF-8 too. Use the above tool on the
Struts prorperties files (message resource bundles) containing non Latin-1
encoding. Without this conversion, the Struts application (or java for that matter)
will not be able to interpret the encoded text. Consequently the
<bean:message> and <html:errors/> will display garbage.


Good luck,

Paolo

BruceLee

Yes. I figure out that if I put
header.my.account=\u8ba9\u7cfb\u7edf\u8bb0\u4f4f\u6211
in Messages.properties
Then it can display correct characters.

Thanks for heplful info!
-Mike