summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-25 19:46:32 +0100
committerraveit65 <[email protected]>2021-02-05 21:36:53 +0100
commit8a653210e2ecf00c11bd8cdf44af2d8c4814fadf (patch)
tree78693278cad2311662a583f6a0b6565ec395a292
parentafd8f48f9b71f68953bc8e6bf4859031475aee0f (diff)
downloadeom-8a653210e2ecf00c11bd8cdf44af2d8c4814fadf.tar.bz2
eom-8a653210e2ecf00c11bd8cdf44af2d8c4814fadf.tar.xz
build: allow users to disable gettext support (--disable-nls)
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac13
-rw-r--r--data/Makefile.am10
-rw-r--r--help/Makefile.am4
-rw-r--r--plugins/Makefile.am4
-rw-r--r--plugins/reload/eom-reload-plugin.c2
-rw-r--r--src/eom-save-as-dialog-helper.c2
-rw-r--r--src/eom-window.c8
-rw-r--r--src/main.c2
9 files changed, 44 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 14163ad..9976986 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,10 +1,14 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+if USE_NLS
+PO_SUBDIR = po
+endif
+
if ENABLE_JPEG
jpeg_DIRS = jpegutils
endif
-SUBDIRS = po $(jpeg_DIRS) cut-n-paste src man plugins help data doc
+SUBDIRS = $(PO_SUBDIR) $(jpeg_DIRS) cut-n-paste src man plugins help data doc
if ENABLE_THUMBNAILER
SUBDIRS += thumbnailer
diff --git a/configure.ac b/configure.ac
index bf4ca02..c336c81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,10 @@ GTK_DOC_CHECK(1.9)
AC_CHECK_FUNCS(strptime)
+GETTEXT_PACKAGE=AC_PACKAGE_NAME
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package.])
+
# ****************************************************************
# Support for nl_langinfo (_NL_MEASUREMENT_MEASUREMENT) (optional)
# ****************************************************************
@@ -62,13 +66,9 @@ fi
# ***********
# Translation
# ***********
-AM_GNU_GETTEXT_VERSION([0.19.8])
-AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8])
AM_GNU_GETTEXT([external])
-
-GETTEXT_PACKAGE=AC_PACKAGE_NAME
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package.])
+AM_GNU_GETTEXT_VERSION([0.19.8])
+AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
@@ -429,5 +429,6 @@ Configure summary:
RSVG support ...............: ${have_rsvg}
Colour management support ..: ${have_lcms}
GObject Introspection.......: ${have_introspection}
+ Gettext support.............: ${USE_NLS}
Thumbnailer.................: ${eom_thumbnailer}
"
diff --git a/data/Makefile.am b/data/Makefile.am
index b7b61a2..67f1b1e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -4,15 +4,25 @@ desktopdir = $(datadir)/applications
desktop_DATA = eom.desktop
desktop_in_files = $(desktop_DATA:.desktop=.desktop.in)
desktop_in_in_files = $(desktop_in_files:.desktop.in=.desktop.in.in)
+
$(desktop_DATA): $(desktop_in_files)
+if USE_NLS
$(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Name --keyword=Comment --keyword=Keywords --template $< -d $(top_srcdir)/po -o $@
+else
+ $(AM_V_GEN) cp $< $@
+endif
appdatadir = $(datadir)/metainfo
appdata_DATA = eom.appdata.xml
appdata_in_files = $(appdata_DATA:.xml=.xml.in)
appdata_in_in_files = $(appdata_in_files:.xml.in=.xml.in.in)
+
$(appdata_DATA): $(appdata_in_files)
+if USE_NLS
$(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
+else
+ $(AM_V_GEN) cp $< $@
+endif
gsettings_ENUM_NAMESPACE = org.mate.eom
gsettings_ENUM_FILES = $(top_srcdir)/src/eom-scroll-view.h \
diff --git a/help/Makefile.am b/help/Makefile.am
index 027b679..4705261 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -7,10 +7,14 @@ HELP_MEDIA = \
figures/eom_start_window.png \
figures/eom_toolbar_editor_window.png
+if USE_NLS
# Add linguas to be ignored, e.g. IGNORE_HELP_LINGUAS = ca de es fr
IGNORE_HELP_LINGUAS =
HELP_LINGUAS = $(if $(IGNORE_HELP_LINGUAS), \
$(filter-out $(IGNORE_HELP_LINGUAS),$(subst /,,$(dir $(wildcard */*.po)))), \
$(subst /,,$(dir $(wildcard */*.po))) )
+else
+HELP_LINGUAS =
+endif
-include $(top_srcdir)/git.mk
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 8e11b07..48cb92f 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -50,7 +50,11 @@ plugins_in_in_files = $(plugins_in_files:.desktop.in=.desktop.in.in)
plugins_DATA = $(plugins_in_files:.plugin.desktop.in=.plugin)
%.plugin: %.plugin.desktop.in
+if USE_NLS
$(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
+else
+ $(AM_V_GEN) cp $< $@
+endif
DISTCLEANFILES = $(plugins_in_files)
CLEANFILES = $(plugins_DATA)
diff --git a/plugins/reload/eom-reload-plugin.c b/plugins/reload/eom-reload-plugin.c
index 1f22eb2..e69b341 100644
--- a/plugins/reload/eom-reload-plugin.c
+++ b/plugins/reload/eom-reload-plugin.c
@@ -119,7 +119,9 @@ eom_reload_plugin_activate (EomWindowActivatable *activatable)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
plugin->ui_action_group = gtk_action_group_new ("EomReloadPluginActions");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (plugin->ui_action_group, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_action_group_add_actions (plugin->ui_action_group, action_entries,
G_N_ELEMENTS (action_entries), plugin->window);
diff --git a/src/eom-save-as-dialog-helper.c b/src/eom-save-as-dialog-helper.c
index 537243f..24f472f 100644
--- a/src/eom-save-as-dialog-helper.c
+++ b/src/eom-save-as-dialog-helper.c
@@ -207,7 +207,9 @@ eom_save_as_dialog_new (GtkWindow *main, GList *images, GFile *base_file)
GtkWidget *label;
xml = gtk_builder_new_from_resource ("/org/mate/eom/ui/eom-multiple-save-as-dialog.ui");
+#ifdef ENABLE_NLS
gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
dlg = GTK_WIDGET (g_object_ref (gtk_builder_get_object (xml, "eom_multiple_save_as_dialog")));
gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (main));
diff --git a/src/eom-window.c b/src/eom-window.c
index 337f16f..a431674 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -4412,8 +4412,10 @@ eom_window_construct_ui (EomWindow *window)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
priv->actions_window = gtk_action_group_new ("MenuActionsWindow");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (priv->actions_window,
GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_action_group_add_actions (priv->actions_window,
action_entries_window,
@@ -4430,8 +4432,10 @@ eom_window_construct_ui (EomWindow *window)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
priv->actions_image = gtk_action_group_new ("MenuActionsImage");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (priv->actions_image,
GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_action_group_add_actions (priv->actions_image,
action_entries_image,
@@ -4450,8 +4454,10 @@ eom_window_construct_ui (EomWindow *window)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
priv->actions_collection = gtk_action_group_new ("MenuActionsCollection");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (priv->actions_collection,
GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_action_group_add_actions (priv->actions_collection,
action_entries_collection,
@@ -4536,8 +4542,10 @@ eom_window_construct_ui (EomWindow *window)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
priv->actions_recent = gtk_action_group_new ("RecentFilesActions");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (priv->actions_recent,
GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
G_GNUC_END_IGNORE_DEPRECATIONS;
g_signal_connect (gtk_recent_manager_get_default (), "changed",
diff --git a/src/main.c b/src/main.c
index cf8abec..5f0806c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -97,9 +97,11 @@ main (int argc, char **argv)
GFile *css_file;
GtkCssProvider *provider;
+#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, EOM_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gdk_set_allowed_backends ("wayland,x11");