Search code examples
c++11codeblockswxwidgets

wxLocale Internationalization sample codes failed to translate


I am writing a wxWidgets project by CodeClocks on windows 10, I want to translate this project into multi-languages. By instructions, I generated a PO file and a MO file by Poedit, and saved the MO file in the application folder. then I copied the internationalization sample code from the link https://github.com/wxWidgets/wxWidgets/tree/WX_3_0_BRANCH/samples/keyboard, When I run the sample codes, the translate failed. If I select "French", I got an error message "Couldn't find/load the internat catalog for the locale 'French_France.1252'", if I select another language, I got error message too. I checked my PO file with Václav, the developer of Poedit, Václav confirmed that the PO file has no problem. Why the translate did not happen? It would be highly appreciated if somebody could give me some instructions.


Solution

  • First, the link to the sample is wrong ("keyboard" instead of "internat"), but I guess this is just a typo. Second, did you really call your translated messages catalog internat.mo (which is what the sample is looking for) and where did you put it? As explained in the documentation, it needs to be in fr subdirectory.

    If you still can't find the problem, try calling wxLog::AddTraceMask("i18n") from your code and look at the debug output to see where is the sample looking for the file.