[gnome-control-center] region: Only show locales for languages that have translations
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: Only show locales for languages that have translations
- Date: Tue, 11 Oct 2011 11:24:23 +0000 (UTC)
commit 3c34c0f02958aa63792466ac3e5fc501a6069dbf
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Tue Oct 11 13:24:25 2011 +0200
region: Only show locales for languages that have translations
panels/common/cc-common-language.c | 21 ++++++++++++++-------
panels/common/gdm-languages.c | 10 +++++-----
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 88fba5e..d2cff06 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 3c774f0..1a1ad1c 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 7730356..5ee33b3 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]