set language



Can somebody tell me how to use Multilanguage with gtk.? I would
like to set the language displayed on GUI during the runtime, is it
possible. Is there any function to do this in gtk, which should
also work under win32!

(Please don't send HTML mail to this list.)

Do you mean that you want your own application to be able to show its
text strings in several languages? How to do that, and how the user
can select what language your application will use with her, is
entirely up to yourself, but it is best to follow established
conventions, of course.

The Unixish way is to follow the LANG or LC_MESSAGES environment
variables. The value of said environment variable is a string like
"de" for German, "zh_CN" for Simplified Chinese, etc. On Windows, only
applications or libraries with a Unixish background might recognise
these environment variables. Some (including GTK itself) use the
language set in the Control Panel's Regional Setting if these
environment variables aren't set. Typically messages in different
languages are in external message catalog files, generated by a
special tool, msgfmt, and accessed through a set of function including
gettext(). Read http://www.fsf.org/manual/gettext/index.html.

(The traditional Windowish way, if I understand correctly, is to have
something close to message catalogs, but in fact DLLs, but containing
no executable code but resources with the message strings.)

You should also note that the strings you pass to GTK for display
should be in Unicode, in UTF-8. UTF-8 is traditionally not used much
on Windows, text instead being either in a specified code page, or in
UTF-16.

Or do you mean that you want GTK itself to show its text strings in
the appropriate language? As said above, GTK will use the language
from the Regional Setting, as long as it has message catalogs
installed for that languae, of course. I don't know if the "dev-c++"
distribution of GTK for Windows includes the message catalogs, and if
they get installed correctly so that GTK finds them. Ask whoever built
your GTK distribution.

--tml





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]