Search code examples
internationalizationwxwidgetsgettext

wxWidgets: User defined (or from config), language dependent strings. How?


Our application (rewritten to wxWidgets) should use mostly common strings from the language catalogs (.mo). But it also uses panels with texts that are tailored for the customer via the configuration file. The configuration files are generated for the customer, so it could be (say) another catalog file. However...

Can one catalog file contain replacements (overwrites) for the default strings from the basic catalog?

Or, can the structure with strings loaded from the catalogs (.mo) be modified programmatically? (I mean if it can be done using some recommended way in the sense "Don't pee against the wind".)

Is there any standardized mechanism for storing the user-defined strings (via the same application)?

Thanks for your time and experience,

Petr


Solution

  • You can load several catalog files by using wxLocale::AddCatalog. The translations are searched for in all the catalogs loaded. If two catalogs contain the same string, I assume the translation is taken from the catalog that was loaded first. I didn't test though, admittedly. Anyway, if this is the case, you need to make sure the custom catalog file is loaded first. That way the translations in the custom catalog have precedence, and effectively they replace the default translations.