mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 15:22:11 +02:00
meson: Ensure clapper uses local translations within the devenv
This patch modifies the initialization routines of clapper to check for CLAPPER_GTK_OVERRIDE_LOCALEDIR and CLAPPER_APP_OVERRIDE_LOCALEDIR and uses that instead of the LOCALEDIR specified in the config.h. It also fixes the bug where libclapper-gtk loads the translations for the clapper application and the clapper application loads the translations for the libclapper-gtk. (It took me shockingly long to figure out why the translations weren't working 🙃) Co-authored-by: Rafał Dzięgiel <rafostar.github@gmail.com> Signed-off-by: Florian "sp1rit" <sp1rit@disroot.org>
This commit is contained in:
@@ -19,6 +19,8 @@ clapper_version_suffix = '-' + version_array[0] + '.0'
|
||||
|
||||
clapper_api_name = meson.project_name() + clapper_version_suffix
|
||||
|
||||
devenv = environment()
|
||||
|
||||
gnome = import('gnome')
|
||||
pkgconfig = import('pkgconfig')
|
||||
i18n = import('i18n')
|
||||
@@ -124,6 +126,8 @@ endif
|
||||
subdir('src')
|
||||
subdir('doc')
|
||||
|
||||
meson.add_devenv(devenv)
|
||||
|
||||
summary({
|
||||
'prefix': prefix,
|
||||
'bindir': bindir,
|
||||
|
@@ -29,13 +29,16 @@
|
||||
gint
|
||||
main (gint argc, gchar **argv)
|
||||
{
|
||||
const gchar *clapper_ldir;
|
||||
GApplication *application;
|
||||
gint status;
|
||||
|
||||
g_setenv ("GSK_RENDERER", "gl", FALSE);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
if (!(clapper_ldir = g_getenv ("CLAPPER_APP_OVERRIDE_LOCALEDIR")))
|
||||
clapper_ldir = LOCALEDIR;
|
||||
bindtextdomain (GETTEXT_PACKAGE, clapper_ldir);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
|
@@ -42,7 +42,7 @@ clapperapp_conf_inc = [
|
||||
]
|
||||
|
||||
config_h = configuration_data()
|
||||
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name() + '-gtk')
|
||||
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name() + '-app')
|
||||
config_h.set_quoted('LOCALEDIR', join_paths (prefix, localedir))
|
||||
config_h.set_quoted('CLAPPER_APP_NAME', 'Clapper')
|
||||
config_h.set_quoted('CLAPPER_APP_ID', app_id)
|
||||
|
@@ -1 +1,3 @@
|
||||
i18n.gettext(meson.project_name() + '-app', preset: 'glib')
|
||||
|
||||
devenv.set('CLAPPER_APP_OVERRIDE_LOCALEDIR', meson.current_build_dir())
|
||||
|
@@ -62,10 +62,14 @@ clapper_gtk_get_player_from_ancestor (GtkWidget *widget)
|
||||
void
|
||||
clapper_gtk_init_translations (void)
|
||||
{
|
||||
const gchar *clapper_gtk_ldir;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
if (!(clapper_gtk_ldir = g_getenv ("CLAPPER_GTK_OVERRIDE_LOCALEDIR")))
|
||||
clapper_gtk_ldir = LOCALEDIR;
|
||||
bindtextdomain (GETTEXT_PACKAGE, clapper_gtk_ldir);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
initialized = TRUE;
|
||||
|
@@ -30,7 +30,7 @@ endforeach
|
||||
subdir('po')
|
||||
|
||||
config_h = configuration_data()
|
||||
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name() + '-app')
|
||||
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name() + '-gtk')
|
||||
config_h.set_quoted('LOCALEDIR', join_paths (prefix, localedir))
|
||||
config_h.set_quoted('CLAPPER_GTK_RESOURCE_PREFIX', clappergtk_resource_prefix)
|
||||
|
||||
|
@@ -1 +1,3 @@
|
||||
i18n.gettext(meson.project_name() + '-gtk', preset: 'glib')
|
||||
|
||||
devenv.set('CLAPPER_GTK_OVERRIDE_LOCALEDIR', meson.current_build_dir())
|
||||
|
Reference in New Issue
Block a user