diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-11 13:24:25 +0200 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-11 13:24:25 +0200 |
commit | 3c34c0f02958aa63792466ac3e5fc501a6069dbf (patch) | |
tree | d927ace865cae6b307b9ec9d28f796b289b1d24e /panels/common | |
parent | dff859e4b7efb4e0b5e723a98bf65f9884a6ea95 (diff) | |
download | gnome-control-center-3c34c0f02958aa63792466ac3e5fc501a6069dbf.tar.gz |
region: Only show locales for languages that have translations
Diffstat (limited to 'panels/common')
-rw-r--r-- | panels/common/cc-common-language.c | 21 | ||||
-rw-r--r-- | panels/common/gdm-languages.c | 10 | ||||
-rw-r--r-- | panels/common/gdm-languages.h | 1 |
3 files changed, 20 insertions, 12 deletions
diff --git a/panels/common/cc-common-language.c b/panels/common/cc-common-language.c index 88fba5e29..d2cff066d 100644 --- a/panels/common/cc-common-language.c +++ b/panels/common/cc-common-language.c @@ -480,7 +480,8 @@ add_other_users_language (GHashTable *ht) props = g_dbus_proxy_get_cached_property (user, "Language"); lang = g_variant_get_string (props, NULL); if (lang != NULL && *lang != '\0' && - cc_common_language_has_font (lang)) { + cc_common_language_has_font (lang) && + gdm_language_has_translations (lang)) { name = gdm_normalize_language_name (lang); if (!g_hash_table_lookup (ht, name)) { language = gdm_get_language_from_name (name, NULL); @@ -509,12 +510,18 @@ cc_common_language_get_initial_languages (void) ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); /* Add some common languages first */ - g_hash_table_insert (ht, g_strdup ("en_US.utf8"), g_strdup (_("English"))); - g_hash_table_insert (ht, g_strdup ("en_GB.utf8"), g_strdup (_("British English"))); - g_hash_table_insert (ht, g_strdup ("de_DE.utf8"), g_strdup (_("German"))); - g_hash_table_insert (ht, g_strdup ("fr_FR.utf8"), g_strdup (_("French"))); - g_hash_table_insert (ht, g_strdup ("es_ES.utf8"), g_strdup (_("Spanish"))); - g_hash_table_insert (ht, g_strdup ("zh_CN.utf8"), g_strdup (_("Chinese (simplified)"))); + if (gdm_language_has_translations ("en_US")) + g_hash_table_insert (ht, g_strdup ("en_US.utf8"), g_strdup (_("English"))); + if (gdm_language_has_translations ("en_GB")) + g_hash_table_insert (ht, g_strdup ("en_GB.utf8"), g_strdup (_("British English"))); + if (gdm_language_has_translations ("de_DE")) + g_hash_table_insert (ht, g_strdup ("de_DE.utf8"), g_strdup (_("German"))); + if (gdm_language_has_translations ("fr_FR")) + g_hash_table_insert (ht, g_strdup ("fr_FR.utf8"), g_strdup (_("French"))); + if (gdm_language_has_translations ("es_ES")) + g_hash_table_insert (ht, g_strdup ("es_ES.utf8"), g_strdup (_("Spanish"))); + if (gdm_language_has_translations ("zh_CN")) + g_hash_table_insert (ht, g_strdup ("zh_CN.utf8"), g_strdup (_("Chinese (simplified)"))); /* Add the languages used by other users on the system */ add_other_users_language (ht); diff --git a/panels/common/gdm-languages.c b/panels/common/gdm-languages.c index 3c774f0ad..1a1ad1cee 100644 --- a/panels/common/gdm-languages.c +++ b/panels/common/gdm-languages.c @@ -323,8 +323,8 @@ language_name_get_codeset_details (const char *language_name, g_free (old_locale); } -static gboolean -language_name_has_translations (const char *language_name) +gboolean +gdm_language_has_translations (const char *language_name) { GDir *dir; char *path; @@ -418,9 +418,9 @@ add_locale (const char *language_name, locale->codeset, locale->modifier); #ifndef WITH_INCOMPLETE_LOCALES - if (!language_name_has_translations (locale->name) && - !language_name_has_translations (locale->id) && - !language_name_has_translations (locale->language_code) && + if (!gdm_language_has_translations (locale->name) && + !gdm_language_has_translations (locale->id) && + !gdm_language_has_translations (locale->language_code) && utf8_only) { g_debug ("Ignoring '%s' as a locale, since it lacks translations", locale->name); gdm_locale_free (locale); diff --git a/panels/common/gdm-languages.h b/panels/common/gdm-languages.h index 7730356cc..5ee33b37b 100644 --- a/panels/common/gdm-languages.h +++ b/panels/common/gdm-languages.h @@ -37,6 +37,7 @@ gboolean gdm_parse_language_name (const char *name, char **codesetp, char **modifierp); char * gdm_normalize_language_name (const char *name); +gboolean gdm_language_has_translations (const char *language_name); G_END_DECLS |