Ecere SDK/eC Forums
http://ecere.org/community/
Print view

程序能翻译,但无法显示汉字
http://ecere.org/community/viewtopic.php?f=30&t=155
Page 1 of 1
Author:  liqi98136 [ Sun Aug 21, 2011 8:58 am ]
Post subject:  程序能翻译,但无法显示汉字

hi J
程序能翻译,但无法显示汉字
后附原代码,帮助找找哪里出错了.
thanks,
liqi
Author:  jerome [ Sun Aug 21, 2011 5:09 pm ]
Post subject:  Re: 程序能翻译,但无法显示汉字

Hi liqi,

are you saying you have problems in this new version, but not in your previous sample?
It could be the order in which the initialization is called (after the form is created).

Doing the initialization in an Application class like in your earlier samples is probably better.
You will want to inherit from GuiApplication rather than Application for GUI applications.

On the other hand, I spent many hours trying to get your first samples working, but gettext refuses to give me any translation!!! It always returns me the original string!
Did you manage to get it working? Of course my system locale is set to english, but I tried to set the LC_ALL and LANG and LANGUAGE variables to other things. I could never get it to work!
Could you please try to add another translation in another locale, e.g. one that is not installed on your system? (e.g. French: Bonjour:) )

Thank you!

-Jerome
Author:  jerome [ Sun Aug 21, 2011 5:49 pm ]
Post subject:  Re: 程序能翻译,但无法显示汉字

Thanks to cortana` on ##mingw, I got it working.

We were missing:

bind_textdomain_codeset(PACKAGE, "UTF-8");

I don't know if this will help you as well

Regards,

Jerome
Author:  jerome [ Sun Aug 21, 2011 7:00 pm ]
Post subject:  Re: 程序能翻译,但无法显示汉字

I am not sure what code page the Windows console is set to on Chinese systems by default.
But to be able to write UTF-8 text to the Windows console, you should invoke:

SetConsoleOutputCP(CP_UTF8); (where CP_UTF8 is defined to be 65001)

At least on Windows XP for whatever reason this does not work with raster fonts, setting the font of the console to 'Lucida Console' fixes it.

This should be useful to output information to the console, as all our localized text will be returned in UTF-8 :)

By the way, have you done anything towards making .po/.mo files for the Ecere SDK yet? :D

I am looking forward to having many localized versions of the SDK :)

Thanks!

Jerome
Author:  jerome [ Mon Aug 22, 2011 7:52 am ]
Post subject:  Re: 程序能翻译,但无法显示汉字

When I call bind_textdomain_codeset in the Ecgettext() constructor, with your original code, this works for me?
All times are UTC-05:00 Page 1 of 1