what value of $LANG is required for gtk-2.0?



 Hi, 

 I inspected gtk-1.3.1 and I'm basing my thoughts on it. I know that it's
rather old version, but please point out to me whether anything I'm talking
about has changed since that version.
 
 It's obvious that locale with utf8 charset is required for gtk2 apps to
function, at least in localized (translated to some language) form (since
gettext() returns strings in the current locale's encoding, locale encoding
should be utf8 for localized GUI be available to the user). In version of gtk
I inspected, gtk wasn't overriding locale inherrited from environment
variables with something else - this means that environment variables should
designate utf8 locale (e.g. en_US.utf8). Unfortunately even on the system with
correct support for utf8 locales 99% of non-gui programs (and even may be all
non-gtk programs) don't work correctly (e.g. all console-based MUAs, may be
all motif apps). Also there is a problem that utf8 locales are not supported
by a lot of unixes correctly AFAIH (but it's unavoidable if we are not going
to hack out version of gettext to return strings in encoding different from
locale's one in order not to require support for utf8 locales from the libc).

 What I propose is to add special code to gdk_set_locale() that will detect
language and territory program runs under for all locale categories
(LC_NUMERIC, LC_TIME, LC_MONETARY, etc) and will select locale for the same
language and territory but with utf8 charset unconditionally, e.g. for
programs running with 
	$LANG=ru_RU.KOI8-R 
	$LC_NUMERIC=en_US
 gdk_set_locale() will call the following locales:
	setlocale(LC_MESSAGES,"ru_RU.utf8");
	setlocale(LC_DATE,"ru_RU.utf8");
	... /*setlocale() calls for other categories*/
	setlocale(LC_NUMERIC,"en_US.utf8");

 Such behaviour will allow to run all non-gtk programs under the former
(non-utf8) locales under which they work much better :) , while automatically
using utf8 locales for gtk programs. For platforms that don't support utf8
locales it may be desirable to disable automatic setting of such locales.

 But I think it's necessary to test which platforms don't support utf8
locales (I won't wonder if XLib from XFree86-3.x doesn't work correctly under
utf8 locale too - and for XLibs from other vendors I think we should be
even less pessimistic). In the worst case, unix ports of gtk2 will be usable
only on Linux + Solaris + FreeBSD for users of non-ascii charsets!

 What do you think about this?

 Best regards,
  -Vlad





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