Natulux wrote: ↑Wed Oct 27, 2021 9:39 am
utelle wrote: ↑Wed Oct 27, 2021 9:22 am
Yes, I think so. For example, there are major differences between Portuguese as spoken in Portugal vs Portuguese as spoken in Brazil. So, only the combination of language and region uniquely identifies the right UI language.
That must be why the widgets library takes the language from the region.
I haven't studied the wxWidgets code in greater detail, but for an unknown combination of language and region English will be chosen.
Natulux wrote: ↑Wed Oct 27, 2021 9:39 am
But that raises another issue:
My languages are mapped by wxWidgets automatically and I have not yet found a documentation to that. At the moment I just point the library at my "languages" directory in which it finds an "en" directory for the english language.
That sounds ok. wxWidgets will first look for the combination of language and region (for example
de_DE or
en_US), but if such a subdirectory is not found it will try the subdirectories corresponding to the language alone (for example,
de or
en). If neither directory is found no message catalog will be loaded and the base language of the application will be used.
Natulux wrote: ↑Wed Oct 27, 2021 9:39 am
But taking your example of portuguese, I should have the full canonial like "en_us", "en_uk" or (just guessing) "po_po" and "po_br" for portuguese.
No, in most cases the differences of a language between different regions are relatively small and almost no one will provide different translations depending on the region (for example
de_DE vs
de_BE vs
de_AT etc). So, for example for German the best approach is to place the translation file(s) in subdirectory
de, so that the correct translation is found automatically for users from Germany, Austria, Switzerland and so on.
For Portuguese it is a different story. For Portuguese you would have usually 2 directories -
pt_PT for Portugal and
pt_BR for Brazil. (The language code
po is unassigned.)
Natulux wrote: ↑Wed Oct 27, 2021 9:39 am
Do you maybe know where to find a documentation how the mapping is done? A list of languages and their matching directory names for example?
A list of languages as known to wxWidgets can be found in
src/common/languageinfo.cpp in the source tree of wxWidgets The raw data for this list can be found in
misc/languages/langtabl.txt. Documentation for translation support in wxWidgets can be found
here.