For example, in this simplest hello world program:
#include <iostream>
int main()
{
std::cout<<"Hello World!"<<std::endl;
return 0;
}
I’d like to see French if user’s environment LANG is set to fr_FR, it might looks like:
$ ./a.out
Hello World!
$ LANG=fr_FR.utf8
$ ./a.out
Bonjour tout le monde!
Is there a guideline of how to archieve this in Linux?
The key is to use “resources” (one per-language, configured to be read at runtime) vs. hard-coding strings. GUI frameworks like Qt and GTK+ make this (relatively) easy.
Here’s a link to the Pango” library used by GTK+ (but not, emphatically, exclusive to GTK+):
Here’s a tutorial on using Pango:
And here’s a tutorial on “gettext()” (which, I believe, Pango uses):