Multilingual application

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.
User avatar
Nucleorion
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sat Jan 07, 2017 10:08 pm

Multilingual application

Postby Nucleorion » Fri Feb 17, 2017 10:29 am

Any tutorial for implement multilinguan function.

I try with poedit follow this tutorial:
http://www.gsy-design.com/how-to-genera ... ng-poedit/

But they no find any string

I try also change parameter according to the page:
https://wiki.wxwidgets.org/Internationalization

thanks

User avatar
doublemax
Moderator
Moderator
Posts: 10554
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Multilingual application

Postby doublemax » Fri Feb 17, 2017 1:44 pm

Are your text literals wrapped in the _() macro?

Other than that, there really is not much that can go wrong.

Also, check the "official" wxWidgets page on that topic:
http://docs.wxwidgets.org/trunk/overview_i18n.html
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 1521
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Multilingual application

Postby ONEEYEMAN » Fri Feb 17, 2017 3:51 pm

Hi,
Did you try the internat sample?
Also, make sure you put you translation files into the directory where they can be found.

Thank you.

User avatar
Nucleorion
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sat Jan 07, 2017 10:08 pm

Re: Multilingual application

Postby Nucleorion » Mon Feb 20, 2017 2:46 pm

Yes, I have _("Button") texts and tags of controls are generated with _() for codeblocks and wxwidgets.

I put .po and .mo files together .cpp files but I dont fill .po file, Only I have header.

en_US.po

Code: Select all

msgid ""
msgstr ""
"Project-Id-Version: rf2pl\n"
"POT-Creation-Date: 2017-02-17 10:57+0100\n"
"PO-Revision-Date: 2017-02-17 10:58+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _(\n"
"X-Poedit-SearchPath-0: .\n"


I cant find strings with poedit to fill .po or create .pot file


Nunki
Experienced Solver
Experienced Solver
Posts: 79
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Multilingual application

Postby Nunki » Mon Feb 20, 2017 8:19 pm

Why not take the xrc approach. With dialogblocks I create the GUI screens and let it create the xrc files instead of c++ code. I copy all these xml files into a ./xrc/nld or ./xrc/eng directory, depending on the language used. A language code associated with a login makes the application load the right xrc files, thus providing the screens in the right language.
Only for fixed texts, I use the database to store strings in several languages with an identifier. So they can be loaded at startup as well.
This approach gives you the ability that, though the pc may be in dutch or german, for example, when a user is french, at login his application wil run in his language.
And above all, your code stays the same, regardless.

Nunki.

User avatar
Nucleorion
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sat Jan 07, 2017 10:08 pm

Re: Multilingual application

Postby Nucleorion » Wed Feb 22, 2017 6:55 am

Thk for all :)

Finally I extract text setting _ how keyword for _("My text") and setting ‪xgettext --force-po -o %o %C %K %F in order for extraction.

I have already translated strings and I have created .po and .mo files.

But how do I now for the user to choose one language or another?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 1521
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Multilingual application

Postby ONEEYEMAN » Wed Feb 22, 2017 7:08 am

Hi,
Did you run the "internat" sample?
Also, the default language is determined by locale.

Thank you.


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 6 guests