程序能翻译,但无法显示汉字

来自中国的朋友,欢迎您在本版面使用中文讨论问题。请注意,如果您想得到不懂中文的人的帮助,请同时提供英文译文。
Help and discussions in Chinese.
Post Reply
liqi98136
Posts: 53
Joined: Sun Jan 17, 2010 11:37 pm

程序能翻译,但无法显示汉字

Post by liqi98136 »

hi J
程序能翻译,但无法显示汉字
后附原代码,帮助找找哪里出错了.
thanks,
liqi
Attachments
hellworld.rar
(14.81 KiB) Downloaded 8743 times
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: 程序能翻译,但无法显示汉字

Post by jerome »

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
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: 程序能翻译,但无法显示汉字

Post by jerome »

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
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: 程序能翻译,但无法显示汉字

Post by jerome »

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
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: 程序能翻译,但无法显示汉字

Post by jerome »

When I call bind_textdomain_codeset in the Ecgettext() constructor, with your original code, this works for me?
Post Reply