Search code examples
gcclocalizationlocale

How do i change Console output of compiler


i want to change the compiled ( which is usually in english) console output in GCC compiler on linux to other local languaue (such as HINDi, chineese ).. i would like to do this in c/c++ language. please guide me Thanks in advance


Solution

  • You need to take a look at the i18n tool gettext. Basically you mark all the text that you might wish to translate at some point with a macro, _("Some text here"), this has to uses:

    1. Allows the source code to be scanned to make a .pot file of potential translations
    2. Calls a translate function that returns the translation if there is one available or the original string otherwise.

    You can then as a separate operation and post compilation/delivery get translators to use the .pot file to provide .po files for specific locales, (language/location combinations), these are then compiled into .mo files that can be added to a specified directory structure. At run time i18n code will look at those locations to try to load the appropriate translations for your location with the clever bit of working up from your exact language & location, your language, the original text.