Locale again

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
Sebastian Rose
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Mar 28, 2005 8:17 pm
Location: Hannover, Germany
Contact:

Locale again

Post by Sebastian Rose »

Anyone knows how use *.po / *.mo files to compile a static binary? Just using wxLocale and the _("") Makro doesn't work for static Builds. I need static versions in different languages, so one can copy just the executable (and no *.mo files) on CD, and use it on different Hosts (even on Hosts without wxWidgets installed :shock:).

Is there some preprocessing tool, that can exchange _("strings") with the ones found in a supplied *.po or *.mo file?
And how to compile wxWidgets like wxFileDialog() statically, so they're buttons are always labeld in german or some other language?
XP prof: --- wxWidgets 2.6.2 --- Mingw Gcc
Debian testing: --- wxWidgets 2.6.2 --- gcc 4.0.2-2 --- Gtk2 2.6.10
mjs
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 09, 2005 3:53 am
Contact:

Re: Locale again

Post by mjs »

Sebastian Rose wrote:Anyone knows how use *.po / *.mo files to compile a static binary? Just using wxLocale and the _("") Makro doesn't work for static Builds. I need static versions in different languages, so one can copy just the executable (and no *.mo files) on CD, and use it on different Hosts (even on Hosts without wxWidgets installed :shock:).
No chance because you cannot use the MemoryFS together with wxLocale. Maybe this is something s/o can/should improve?
Sebastian Rose wrote:Is there some preprocessing tool, that can exchange _("strings") with the ones found in a supplied *.po or *.mo file?
And how to compile wxWidgets like wxFileDialog() statically, so they're buttons are always labeld in german or some other language?
Take a look at the wxLocale constructor:

Code: Select all

wxLocale(int language, int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING)
Set "language" to the appropriate language code.

Regards,
Mark
Sebastian Rose
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Mar 28, 2005 8:17 pm
Location: Hannover, Germany
Contact:

Post by Sebastian Rose »

I know how to handle locales, but just thought there would be a way to use my *.mo files in a static build.

So I'll use good old Perl and make 'make german' to exchange _("") Strings together with xgettext.

thanx
XP prof: --- wxWidgets 2.6.2 --- Mingw Gcc
Debian testing: --- wxWidgets 2.6.2 --- gcc 4.0.2-2 --- Gtk2 2.6.10
Sebastian Rose
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Mar 28, 2005 8:17 pm
Location: Hannover, Germany
Contact:

Post by Sebastian Rose »

Here it comes. I wrotea little Perlskript that replaces _("") with the translation found in *.po. You can change the macro used in the destination files. So it is usefull for all multilanguage projects, like PHP sites. Just replace _("ENGLISCH") with (("FRENCH").

Not widly tested yet.

language_build.pl
XP prof: --- wxWidgets 2.6.2 --- Mingw Gcc
Debian testing: --- wxWidgets 2.6.2 --- gcc 4.0.2-2 --- Gtk2 2.6.10
Post Reply