summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-29 10:31:14 +0200
committerraveit65 <[email protected]>2020-08-06 13:04:05 +0200
commit459f2ae98df179bd4f466805c3af3d7c82ad09f0 (patch)
tree1ae425fb4dab0440369a21e1b81cee4a344c87cb /libmate-desktop
parent32aa6ed222c3f2fdeb1f9c059dea83cb49b46954 (diff)
downloadmate-desktop-459f2ae98df179bd4f466805c3af3d7c82ad09f0.tar.bz2
mate-desktop-459f2ae98df179bd4f466805c3af3d7c82ad09f0.tar.xz
mate-languages: portability of localedir fallback
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-languages.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/libmate-desktop/mate-languages.c b/libmate-desktop/mate-languages.c
index f6a4ff6..57ce6ab 100644
--- a/libmate-desktop/mate-languages.c
+++ b/libmate-desktop/mate-languages.c
@@ -370,19 +370,26 @@ locale_dir_has_mo_files (const gchar* path)
gboolean
mate_language_has_translations (const char *code)
{
- gboolean has_translations;
- gchar *path = NULL;
+ gboolean has_translations;
+ gchar *path;
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);
+ const char * const *system_data_dirs;
+ int i = 0;
+
+ system_data_dirs = g_get_system_data_dirs ();
+ while ((system_data_dirs[i] != NULL) && (has_translations == FALSE)) {
+ g_free (path);
+ path = g_build_filename (system_data_dirs[i], "locale", code, "LC_MESSAGES", NULL);
+ has_translations = locale_dir_has_mo_files (path);
+ ++i;
+ }
}
- g_free(path);
+ g_free (path);
return has_translations;
}