kde vs. locales
Oswald Buddenhagen
ossi at kde.org
Sat Nov 24 19:35:15 GMT 2007
hi,
chusslove and me have been discussing how to deal with locales until our
head started to hurt. :}
here's what we know:
kde is currently mostly an island: because it uses its own settings,
kde apps don't play nice in foreign environemnts and the other way
round. some environment variables are read, but mostly they just confuse
the situation even more.
gnome otoh seems to comply completely with the usual locale(1) settings
via environment variables. locale settings are based on already set
variables (when using startx) or the variables set by gdm (via the
somewhat usable language chooser).
needless to say, standards compliance is good. so here's what i've come
up with:
---------
upon app construction, klocale itself does not read any kde settings,
but uses only the gettext vars.
klocale::setLocale() - apart from initializing klocale - overwrites
LANGUAGE, matches the requested locale against installed system locales
and overwrites LC_* (and unsets LANG to avoid confusion) if a match was
found.
then, there is klocale::setKdeLocale() (or so) that calls setLocale()
with the kde-wide config setting (overridable with KDE_LANG) to initialize
itself. if no explicit kde settings exist, setLocale is not called.
kdeinit (as the mother of all kde processes) and out-of-kdeinit
processes run from startkde use setKdeLocale(). that way the locale is
set for the session as a whole, including non-kde apps. and if apps are
started in a konsole, the locale can be overridden - even for kde apps.
---------
one tiny problem: environment variables are inherited at program
startup. that means that changing the language requires logging out.
this can be remedied by kcm_locale giving kdeinit a kick and kdeinit
broadcasting a change notification if something actually changes -
krunner, etc. would subscribe to it.
a somewhat less tiny problem: kde currently allows incredibly
fine-grained localization settings which simply cannot be represented
via LC_*. the kcm_locale could try to match the settings to existing
locales. if no match is found, a) the user is prompted to confirm and
b) klocale is instructed to use the kde setting instead of the
corresponding LC_* for this particular setting, thus making it
inconsistent with non-kde apps again. i'm not sure it's worth it -
maybe the kcm should just offer the preset locales instead.
thoughts?
--
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
More information about the kde-core-devel
mailing list