GNOME Bugzilla – Bug 333982
Fallback to $LANG whenever NULL PangoLanguage is used
Last modified: 2006-12-06 22:58:57 UTC
Whenever a NULL PangoLanguage is used, we should fall back to $LANG and other env vars. With Gtk+ code, setting language is not much problem, but code not using Gtk+ has a hard time to figure out what to pass in for PangoLanguage (other than say NULL and "en".)
The logic for this is already in gtk_get_default_language() (except that there's no need to special handle '.' and '@'. I've fixed pango_language_from_string to do that already.) The most non intrusive way is to just go on and add pango_get_default_language(), and leave it to the user to set context language to that of get_default_language.
Created attachment 67605 [details] [review] my patch I wrote a patch for this bug. I added pango_get_default_language( ) in this patch.
Thanks LingNing. Can you update the patch to include documentation (copy from gtk+ and adapt), and hook it into pango.def and docs/pango-sections.txt too?
ok, I will do it. :)
Created attachment 67610 [details] [review] modified patch add the documentation , and add it into pango.def and docs/pango-sections.txt.
Committed after renaming to pango_language_get_default() and docs improvement. 2006-12-06 Behdad Esfahbod <behdad@gnome.org> Bug 333982 – Fallback to $LANG whenever NULL PangoLanguage is used Patch from LingNing Zhang * docs/pango-sections.txt: * docs/tmpl/utils.sgml: * pango/pango-context.c: * pango/pango-types.h: * pango/pango-utils.c (_pango_get_lc_ctype), (pango_language_get_default): * pango/pango.def: New public function pango_language_get_default(). Note that, this does not make Pango fallback to the default language automatically, but the user can use this function to set the default language of the locale on a context: pango_context_set_language (context, pango_language_get_default());