@Neutrino: Am i right if i say that python can only use the language which is set in the environment variable LANG or a default language?
Here an extract of this page.
Thanks to Juha Sahakangas on the #gtk+ IRC channel for providing the explanation: For this particular case the locale module needs to be used instead of gettext. Python's gettext module is pure python, it doesn't actually set the text domain in a way that the C library can read, but locale does (by calling libc). So long as that's done, GtkBuilder already works the way you're asking it to.
For now, the program use the default locale of user until we find the solution:
self.sys_locale = locale.getdefaultlocale()
locale.setlocale(locale.LC_ALL, self.sys_locale + ".utf8")
The setlocale method require that locale specified must be installed on user system. That's the problem, because what we want is to permit the user to use the language he wants, in the language selector. (this is important in a live session).
The language selected by user is set in self.preferences("locale"):
locales = os.listdir(self.locale_path)
if self.preferences["locale"] not in locales:
if self.sys_locale in locales:
self.preferences["locale"] = self.sys_locale
self.preferences["locale"] = self.default_locale