From: Sebastien Date: Thu, 6 Aug 2020 11:52:01 +0000 (+0000) Subject: Initialize the translations on start if they are available X-Git-Tag: 22.02.122~41^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f33e2014a859f312037453a45e6070f886c64977;p=thirdparty%2Fplymouth.git Initialize the translations on start if they are available setlocale was already called on filesystem mounting but that's not enough to cover all the cases. The call needs to be conditional because doing it at a time where the locales are not available (in the initrd) would result in translations to not be working. --- diff --git a/src/Makefile.am b/src/Makefile.am index 95ed0192..cbba2be4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,7 @@ AM_CPPFLAGS = -I$(top_srcdir) \ -I$(srcdir)/libply \ -I$(srcdir)/libply-splash-core \ -I$(srcdir) \ + -DPLYMOUTH_LOCALE_DIRECTORY=\"$(localedir)\" \ -DPLYMOUTH_LOG_DIRECTORY=\"$(localstatedir)/log\" \ -DPLYMOUTH_SPOOL_DIRECTORY=\"$(localstatedir)/spool/plymouth\" \ -DPLYMOUTH_TIME_DIRECTORY=\"$(localstatedir)/lib/plymouth/\" \ diff --git a/src/main.c b/src/main.c index 8848ad0d..ab614ca1 100644 --- a/src/main.c +++ b/src/main.c @@ -2089,6 +2089,10 @@ 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)) + setlocale(LC_ALL, ""); + ply_command_parser_add_options (state.command_parser, "help", "This help message", PLY_COMMAND_OPTION_TYPE_FLAG, "attach-to-session", "Redirect console messages from screen to log", PLY_COMMAND_OPTION_TYPE_FLAG,