I am using GNU gettext for translations and it works. The following test code shows the idea of my implementation:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
int main()
{
  /* Setting the i18n environment */
  setlocale (LC_ALL, "");
  bindtextdomain ("hello", getenv("PWD"));
  textdomain ("hello");
  /* Example of i18n usage */
  std::cout << _("Hello World!") << std::endl;
  setenv("LANGUAGE", "fr", 1);
  std::cout << _("Hello World!") << std::endl;
  return EXIT_SUCCESS;
}
I have a working .mo file, so when I run the program I get:
Hello World!
Bonjour le monde!
So far so good. But I have to forward the translated strings to a 3rd party application, and there I need to indicate the encoding (Latin 1, Latin 9, Cyrillic, UTF-8, etc).
How can I get the encoding at run time?
 
     
    