app, tools: localization for GimpLanguageStore languages must happen at runtime.

Unlike the GimpTranslationStore which can use a list of pre-localized
languages (each language in its own name), the GimpLanguageStore must be
displayed in the currently used locale.
This commit is contained in:
Jehan 2024-08-10 14:48:30 +02:00
parent 4d79e9db0b
commit a106acd408
2 changed files with 23 additions and 18 deletions

View file

@ -31,6 +31,8 @@
#include "gimplanguagestore-data.h"
#endif
#include "gimp-intl.h"
static void gimp_language_store_constructed (GObject *object);
@ -83,10 +85,24 @@ gimp_language_store_constructed (GObject *object)
#ifdef HAVE_ISO_CODES
for (gint i = 0; i < GIMP_ALL_LANGS_SIZE; i++)
{
GimpLanguageDef def = GimpAllLanguages[i];
GimpLanguageDef def = GimpAllLanguages[i];
gchar *localized_name = g_strdup (dgettext ("iso_639_3", def.name));
gchar *semicolon;
/* there might be several language names; use the first one */
semicolon = strchr (localized_name, ';');
if (semicolon)
{
gchar *temp = localized_name;
localized_name = g_strndup (localized_name, semicolon - localized_name);
g_free (temp);
}
GIMP_LANGUAGE_STORE_GET_CLASS (object)->add (GIMP_LANGUAGE_STORE (object),
def.name, def.code);
localized_name, def.code);
g_free (localized_name);
}
#endif
}

View file

@ -490,9 +490,7 @@ iso_codes_parser_entry (IsoCodesParser *parser,
if (lang && *lang && code && *code)
{
gchar *semicolon;
gchar *localized_name = g_strdup (dgettext ("iso_639_3", lang));
gboolean save_anyway = FALSE;
gboolean save_anyway = FALSE;
/* If the language is in our base table, we save its standard English name. */
if (g_hash_table_contains (parser->base_lang_list, code))
@ -501,21 +499,12 @@ iso_codes_parser_entry (IsoCodesParser *parser,
save_anyway = TRUE;
}
/* there might be several language names; use the first one */
semicolon = strchr (localized_name, ';');
if (semicolon)
{
gchar *temp = localized_name;
localized_name = g_strndup (localized_name, semicolon - localized_name);
g_free (temp);
}
/* In any case, we save the name in user-set language for all lang
* with part 1 or part 2 code, or for the few language with no
* part 1|2 code but for which we have a localization.
/* In any case, we save the name in US English for all lang with
* part 1 or part 2 code, or for the few language with no part 1|2
* code but for which we have a localization.
*/
if (has_part12 || save_anyway)
g_hash_table_insert (all_lang_list, g_strdup (code), localized_name);
g_hash_table_insert (all_lang_list, g_strdup (code), g_strdup (lang));
}
}