i18n and Unicode Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

i18n and Unicode

Post by Auria » Mon May 21, 2007 8:10 pm

I am writing an app in unicode, with i18n. I use unicode characters, written like _("blah blah \u00FC blah blah")

however, when i extract the translation with gettext, it leaves the \u00FC in plain text, and when i run my app the translation is not reckoniez because of this. I have found a workaround by editing the text in the .po file and replacing the unicode escape sequences by the actual character, but does anyone know a way to make it work correctly without involving me editing even the original entries and not only the translation? thanks

swapd0
I live to help wx-kind
I live to help wx-kind
Posts: 169
Joined: Mon May 14, 2007 11:16 am
Location: Spain

Post by swapd0 » Tue May 22, 2007 8:30 am

For unicode applications you must use _T() instead of _().

mispunt
Experienced Solver
Experienced Solver
Posts: 59
Joined: Tue Oct 19, 2004 3:23 pm
Location: Ede, Holland

Post by mispunt » Tue May 22, 2007 9:03 am

swapd0 wrote:For unicode applications you must use _T() instead of _().
That is not true. _T() is to tell i18n to NOT translate, _() will translate.
OS: win XP pro
Compiler: MingW
wxWidgets version: 2.6.2

swapd0
I live to help wx-kind
I live to help wx-kind
Posts: 169
Joined: Mon May 14, 2007 11:16 am
Location: Spain

Post by swapd0 » Tue May 22, 2007 9:15 am

mispunt wrote:
swapd0 wrote:For unicode applications you must use _T() instead of _().
That is not true. _T() is to tell i18n to NOT translate, _() will translate.
Someone have tried to use both macros?
Maybe you must write something like this, _T(_("foo")) or this _(_T("foo")) ?

redrgreen
Knows some wx things
Knows some wx things
Posts: 30
Joined: Tue Oct 26, 2004 9:44 am

Post by redrgreen » Tue May 22, 2007 10:27 am

The library must be complied with wxUSE_UNICODE set to 1 which is not the default did you do this? Also I think swapd0 is correct _T() or wxT() is the correct option, not _()

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Tue May 22, 2007 3:07 pm

redrgreen wrote:The library must be complied with wxUSE_UNICODE set to 1 which is not the default did you do this? Also I think swapd0 is correct _T() or wxT() is the correct option, not _()
Yes of course i did

Tne app works fine, it's just that gettext doesnt reckognize the unicode chars when i extract strings to translate them. as i said i am able to fix it manually but its annoying

EDIT 13-04-2010 : marking this as closed, years after the initial post. the solution is of course to encode the source files as unicode instead of using backslash-U escapes

Post Reply