From dc1771918bc9360248f40e9be097fe9ec764be59 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Thu, 26 Feb 2026 16:38:00 -0300 Subject: [PATCH] app: Only show the installed locales for GIMP Closes: #15468 There is no point on showing languages that can not be used. This was confusing distro package and Windows installer users. --- app/widgets/gimptranslationstore.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/widgets/gimptranslationstore.c b/app/widgets/gimptranslationstore.c index abd06ade52..98da908ba7 100644 --- a/app/widgets/gimptranslationstore.c +++ b/app/widgets/gimptranslationstore.c @@ -107,6 +107,9 @@ static void gimp_translation_store_constructed (GObject *object) { GList *sublist = NULL; +#ifdef HAVE_ISO_CODES + gchar *mo_path = NULL; +#endif if (GIMP_TRANSLATION_STORE (object)->manual_l18n) sublist = gimp_help_get_installed_languages (); @@ -125,8 +128,16 @@ gimp_translation_store_constructed (GObject *object) if (! GIMP_TRANSLATION_STORE (object)->manual_l18n || g_list_find_custom (sublist, def.code, (GCompareFunc) g_strcmp0)) - GIMP_LANGUAGE_STORE_GET_CLASS (object)->add (GIMP_LANGUAGE_STORE (object), - def.name, def.code); + { + /* there might not be all languages; only show the installed (see #15468) */ + mo_path = g_strdup_printf ("%s/share/locale/%s/LC_MESSAGES/%s.mo", gimp_installation_directory(), def.code, GETTEXT_PACKAGE); + if (g_file_test (mo_path, G_FILE_TEST_EXISTS) || g_strcmp0 (def.code, "en_US") == 0) + { + GIMP_LANGUAGE_STORE_GET_CLASS (object)->add (GIMP_LANGUAGE_STORE (object), + def.name, def.code); + } + g_free(mo_path); + } } g_return_if_fail (system_lang != NULL);