mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +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
|
clapper_api_name = meson.project_name() + clapper_version_suffix
|
||||||
|
|
||||||
|
devenv = environment()
|
||||||
|
|
||||||
gnome = import('gnome')
|
gnome = import('gnome')
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
i18n = import('i18n')
|
i18n = import('i18n')
|
||||||
@@ -124,6 +126,8 @@ endif
|
|||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('doc')
|
subdir('doc')
|
||||||
|
|
||||||
|
meson.add_devenv(devenv)
|
||||||
|
|
||||||
summary({
|
summary({
|
||||||
'prefix': prefix,
|
'prefix': prefix,
|
||||||
'bindir': bindir,
|
'bindir': bindir,
|
||||||
|
@@ -29,13 +29,16 @@
|
|||||||
gint
|
gint
|
||||||
main (gint argc, gchar **argv)
|
main (gint argc, gchar **argv)
|
||||||
{
|
{
|
||||||
|
const gchar *clapper_ldir;
|
||||||
GApplication *application;
|
GApplication *application;
|
||||||
gint status;
|
gint status;
|
||||||
|
|
||||||
g_setenv ("GSK_RENDERER", "gl", FALSE);
|
g_setenv ("GSK_RENDERER", "gl", FALSE);
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
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");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
textdomain (GETTEXT_PACKAGE);
|
textdomain (GETTEXT_PACKAGE);
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ clapperapp_conf_inc = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
config_h = configuration_data()
|
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('LOCALEDIR', join_paths (prefix, localedir))
|
||||||
config_h.set_quoted('CLAPPER_APP_NAME', 'Clapper')
|
config_h.set_quoted('CLAPPER_APP_NAME', 'Clapper')
|
||||||
config_h.set_quoted('CLAPPER_APP_ID', app_id)
|
config_h.set_quoted('CLAPPER_APP_ID', app_id)
|
||||||
|
@@ -1 +1,3 @@
|
|||||||
i18n.gettext(meson.project_name() + '-app', preset: 'glib')
|
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
|
void
|
||||||
clapper_gtk_init_translations (void)
|
clapper_gtk_init_translations (void)
|
||||||
{
|
{
|
||||||
|
const gchar *clapper_gtk_ldir;
|
||||||
|
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
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");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
|
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
|
@@ -30,7 +30,7 @@ endforeach
|
|||||||
subdir('po')
|
subdir('po')
|
||||||
|
|
||||||
config_h = configuration_data()
|
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('LOCALEDIR', join_paths (prefix, localedir))
|
||||||
config_h.set_quoted('CLAPPER_GTK_RESOURCE_PREFIX', clappergtk_resource_prefix)
|
config_h.set_quoted('CLAPPER_GTK_RESOURCE_PREFIX', clappergtk_resource_prefix)
|
||||||
|
|
||||||
|
@@ -1 +1,3 @@
|
|||||||
i18n.gettext(meson.project_name() + '-gtk', preset: 'glib')
|
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