]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
i18n: Check for NL plymouth.mo file instead of /usr/share/locale existence
authorHans de Goede <hdegoede@redhat.com>
Tue, 15 Aug 2023 10:23:05 +0000 (12:23 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 15 Aug 2023 10:33:11 +0000 (12:33 +0200)
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 <hdegoede@redhat.com>
src/main.c

index 85bababa4210f7e8b4d8c58c933e8b20fd9942d3..d60b42e85fe5bf26b3500d196e252039967841f7 100644 (file)
@@ -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,