- gchar *locale, *p;
-
- /* get the default language from the locale
- (based on gtk_get_default_language in gtkmain.c) */
- locale = g_strdup(setlocale(LC_CTYPE, NULL));
- if ((p = strchr(locale, '.'))) *p = '\0'; /* strip off the . */
- if ((p = strchr(locale, '@'))) *p = '\0'; /* strip off the @ */
+ static PangoLanguage *lang = NULL;
+
+ if (lang == NULL) {
+#if PANGO_VERSION_MAJOR > 1 || \
+ (PANGO_VERSION_MAJOR == 1 && PANGO_VERSION_MINOR >= 16)
+ lang = pango_language_get_default();
+#else
+ gchar *locale, *p;
+ /* get the default language from the locale
+ (based on gtk_get_default_language in gtkmain.c) */
+ locale = g_strdup(setlocale(LC_CTYPE, NULL));
+ if ((p = strchr(locale, '.'))) *p = '\0'; /* strip off the . */
+ if ((p = strchr(locale, '@'))) *p = '\0'; /* strip off the @ */
+ lang = pango_language_from_string(locale);
+ g_free(locale);
+#endif
+ }