From 79b725a1ba19e252822521f4551608d04f677d40 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 15 Aug 2023 12:16:47 +0200 Subject: [PATCH 1/3] meson: Fix PLYMOUTH_LOCALE_DIRECTORY and PLYMOUTH_DRM_ESCROW_DIRECTORY defines After the conversion to meson to following CFLAGS were passed: -DPLYMOUTH_LOCALE_DIRECTORY="share/locale" -DPLYMOUTH_DRM_ESCROW_DIRECTORY="libexec/plymouth" Note the missing "/usr/" prefix. Fix these so that the locale check and drm-escrow binary work again. Signed-off-by: Hans de Goede --- src/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/meson.build b/src/meson.build index 13ea0d98..bef3f712 100644 --- a/src/meson.build +++ b/src/meson.build @@ -22,8 +22,8 @@ plymouthd_deps = [ ] plymouthd_cflags = [ - '-DPLYMOUTH_LOCALE_DIRECTORY="@0@"'.format(get_option('localedir')), - '-DPLYMOUTH_DRM_ESCROW_DIRECTORY="@0@"'.format(get_option('libexecdir') / 'plymouth'), + '-DPLYMOUTH_LOCALE_DIRECTORY="@0@"'.format(get_option('prefix') / get_option('localedir')), + '-DPLYMOUTH_DRM_ESCROW_DIRECTORY="@0@"'.format(get_option('prefix') / get_option('libexecdir') / 'plymouth'), '-DPLYMOUTH_LOG_DIRECTORY="@0@"'.format('/var/log'), '-DPLYMOUTH_SPOOL_DIRECTORY="@0@"'.format(plymouthd_spool_dir), ] From c44a310575ef8a425b87e266b14082d0ea34ff9a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 15 Aug 2023 12:19:40 +0200 Subject: [PATCH 2/3] i18n: Fix translations not working after meson conversion After the meson conversion ENABLE_NLS and PACKAGE are no longer defined. The meson i18n module should ensure that dgettext() is always available, so simply always use it to fix the translations not working. Signed-off-by: Hans de Goede --- src/libply/ply-i18n.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libply/ply-i18n.h b/src/libply/ply-i18n.h index 6e4e471b..4d06cb13 100644 --- a/src/libply/ply-i18n.h +++ b/src/libply/ply-i18n.h @@ -17,11 +17,7 @@ #ifndef PLY_I18N_H #define PLY_I18N_H -#ifdef ENABLE_NLS #include -#define _(String) dgettext (PACKAGE, String) -#else -#define _(String) (String) -#endif +#define _(String) dgettext ("plymouth", String) #endif /* PLY_I18N_H */ From c14e7857c96dd443ae3dd4ed98efa9284dbf014d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 15 Aug 2023 12:23:05 +0200 Subject: [PATCH 3/3] 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 --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,