summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-languages.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/libmate-desktop/mate-languages.c b/libmate-desktop/mate-languages.c
index 865c5ca..f6a4ff6 100644
--- a/libmate-desktop/mate-languages.c
+++ b/libmate-desktop/mate-languages.c
@@ -325,25 +325,12 @@ language_name_get_codeset_details (const char *language_name,
setlocale (LC_CTYPE, old_locale);
}
-/**
- * mate_language_has_translations:
- * @code: an ISO 639 code string
- *
- * Returns %TRUE if there are translations for language @code.
- *
- * Return value: %TRUE if there are translations for language @code.
- *
- * Since: 1.22
- */
-gboolean
-mate_language_has_translations (const char *code)
+static gboolean
+locale_dir_has_mo_files (const gchar* path)
{
GDir *dir;
const char *name;
gboolean has_translations;
- g_autofree char *path = NULL;
-
- path = g_build_filename (MATELOCALEDIR, code, "LC_MESSAGES", NULL);
has_translations = FALSE;
dir = g_dir_open (path, 0, NULL);
@@ -370,6 +357,35 @@ mate_language_has_translations (const char *code)
return has_translations;
}
+/**
+ * mate_language_has_translations:
+ * @code: an ISO 639 code string
+ *
+ * Returns %TRUE if there are translations for language @code.
+ *
+ * Return value: %TRUE if there are translations for language @code.
+ *
+ * Since: 1.22
+ */
+gboolean
+mate_language_has_translations (const char *code)
+{
+ gboolean has_translations;
+ gchar *path = NULL;
+
+ path = g_build_filename (MATELOCALEDIR, code, "LC_MESSAGES", NULL);
+ has_translations = locale_dir_has_mo_files (path);
+
+ if (!has_translations) {
+ g_free(path);
+ path = g_build_filename ("/usr/share/locale", code, "LC_MESSAGES", NULL);
+ has_translations = locale_dir_has_mo_files (path);
+ }
+
+ g_free(path);
+ return has_translations;
+}
+
static gboolean
add_locale (const char *language_name,
gboolean utf8_only)