Issue #13774: languages list is not localized on AppImage.

Seems like our CI runners are configured with POSIX locale. Both C and
POSIX locales are basically overriding any attempt to localize during
the build (setting LANGUAGE doesn't work) and unfortunately we are now
self-localizing the list of languages during build.

So let's add a bogus en_US.UTF-8 locale before setting LANGUAGE. This
should fix the issue. It would probably also fix the same issue for
various third-party packages if distributions' build machines are set
similarly!

(cherry picked from commit 88261f8b4c)
This commit is contained in:
Jehan 2025-11-23 12:27:14 +01:00 committed by Bruno Lopes
parent 1ac19bec2d
commit 4c5b7afec5
No known key found for this signature in database
2 changed files with 23 additions and 0 deletions

View file

@ -219,11 +219,14 @@ deps-debian-nonreloc:
libwmf-dev
libxmu-dev
libxpm-dev
locales
mypaint-brushes
poppler-data
python3
python3-gi
python3-gi-cairo" >> Dockerfile
- echo "RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen" >> Dockerfile
- echo "RUN locale-gen" >> Dockerfile
# Prepare environ
- echo "FROM $CI_REGISTRY_IMAGE:build-debian-${DEB_VERSION}-${RUNNER}" > Dockerfile2;
- echo "RUN printf \"\e[0Ksection_start:\`date +%s\`:environ[collapsed=true]\r\e[0KPreparing build environment\n\"" >> Dockerfile2;

View file

@ -278,6 +278,26 @@ gimp_language_store_parser_init (GError **error)
goto cleanup;
}
locale = setlocale (LC_ALL, NULL);
if (g_strcmp0 (locale, "C") == 0 || g_strcmp0 (locale, "POSIX") == 0)
{
/* Note: we do not care about what we set, except not C or POSIX.
* It may be any valid locale. This needs to be set so that this
* script works even on build systems with C or POSIX locale. In
* these 2 cases only, the LANGUAGE is ignored and our whole
* self-localizing code below would be basically moot.
*/
g_setenv ("LC_ALL", "en_US.UTF-8", TRUE);
if (setlocale (LC_ALL, "") == NULL)
{
g_printerr ("ERROR: %s: setlocale() failed. "
"The build system needs to be set up for localization. "
"Please install at least \"en_US.UTF-8\" or set a locale other than C or POSIX.\n",
__FILE__);
exit (EXIT_FAILURE);
}
}
/* Generate the localized language names. */
g_hash_table_iter_init (&lang_iter, l10n_lang_list);
gimp_bind_text_domain ("iso_639_3", ISOCODES_LOCALEDIR);