From: Hans de Goede Date: Tue, 15 Aug 2023 10:23:05 +0000 (+0200) Subject: i18n: Check for NL plymouth.mo file instead of /usr/share/locale existence X-Git-Tag: 23.51.283~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c14e7857c96dd443ae3dd4ed98efa9284dbf014d;p=thirdparty%2Fplymouth.git i18n: Check for NL plymouth.mo file instead of /usr/share/locale existence setlocale () does not work when there is no locale info for the selected LANG / LC_MESSAGES. But it does cache the set LANG / LC_MESSAGES and on subsequent setlocale () calls with the same LANG / LC_MESSAGES it does not recheck for the locale info. Thus if the initrd does not have translations then the setlocale () call should be delayed to after the chroot so that e.g. the "Installing Updates..." text, which only is shown after the chroot, gets translated properly. So far we have been checking the /usr/share/locale dir exists, but it is possible that some initrd generators may create that without the necessary locale info being available. Instead check for the NL plymouth.mo file, assuming that if that is available we have all the necessary locale info. Signed-off-by: Hans de Goede --- diff --git a/src/main.c b/src/main.c index 85bababa..d60b42e8 100644 --- a/src/main.c +++ b/src/main.c @@ -2240,7 +2240,7 @@ main (int argc, state.loop = ply_event_loop_get_default (); /* Initialize the translations if they are available (!initrd) */ - if (ply_directory_exists (PLYMOUTH_LOCALE_DIRECTORY)) + if (ply_file_exists (PLYMOUTH_LOCALE_DIRECTORY "/nl/LC_MESSAGES/plymouth.mo")) setlocale (LC_ALL, ""); ply_command_parser_add_options (state.command_parser,