From 0ff5527f5b057d26e75ea7c44ec4ea809c140cdc Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 8 Feb 2021 11:13:05 +0100 Subject: build: allow users to disable gettext support (--disable-nls) --- Makefile.am | 8 ++++++-- caja/Makefile.am | 6 +++++- configure.ac | 24 +++++++++++++----------- data/Makefile.am | 8 ++++++++ help/Makefile.am | 4 ++++ src/main.c | 4 ++++ src/server.c | 4 ++++ 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6c4f1be..ed65310 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,13 +7,17 @@ else CAJA = endif +if USE_NLS +PO_SUBDIR = po +endif + SUBDIRS = \ mate-submodules \ data \ src \ help \ - $(CAJA) \ - po + $(CAJA) \ + $(PO_SUBDIR) distcleancheck_listfiles = find . -type f -print | grep -v 'omf\.out' diff --git a/caja/Makefile.am b/caja/Makefile.am index b8310c5..a2c9d06 100644 --- a/caja/Makefile.am +++ b/caja/Makefile.am @@ -23,7 +23,11 @@ extension_in_in_files = libcaja-engrampa.caja-extension.desktop.in.in extension_in_files = $(extension_in_in_files:.caja-extension.desktop.in.in=.caja-extension.desktop.in) extension_DATA = $(extension_in_files:.caja-extension.desktop.in=.caja-extension) $(extension_DATA): $(extension_in_files) - $(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ +if USE_NLS + $(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Copyright --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif DISTCLEANFILES = $(extension_in_files) CLEANFILES = $(extension_DATA) diff --git a/configure.ac b/configure.ac index 640c208..a20f9ab 100644 --- a/configure.ac +++ b/configure.ac @@ -136,9 +136,10 @@ GETTEXT_PACKAGE=AC_PACKAGE_NAME AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [GetText Package]) +AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.19.8]) AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8]) -AM_GNU_GETTEXT([external]) +AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"]) dnl ****************************** @@ -249,14 +250,15 @@ Configure summary: ${PACKAGE_STRING} `echo $PACKAGE_STRING | sed "s/./=/g"` - Source code location: ${srcdir} - Compiler: ${CC} - Compiler flags: ${CFLAGS} - Warning flags: ${WARN_CFLAGS} - Linker flags: ${LDFLAGS} - Caja support: ${enable_caja_actions} - PackageKit support: ${enable_packagekit} - Run in place ${enable_run_in_place} - Use libmagic: ${enable_magic} - JSON support: ${enable_json_glib} + Source code location: ${srcdir} + Compiler: ${CC} + Compiler flags: ${CFLAGS} + Warning flags: ${WARN_CFLAGS} + Linker flags: ${LDFLAGS} + Caja support: ${enable_caja_actions} + PackageKit support: ${enable_packagekit} + Run in place ${enable_run_in_place} + Use libmagic: ${enable_magic} + JSON support: ${enable_json_glib} + Native Language support: ${USE_NLS} " diff --git a/data/Makefile.am b/data/Makefile.am index fdc4dde..8ed7529 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,7 +5,11 @@ desktop_in_in_files = engrampa.desktop.in.in desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in) desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) $(desktop_DATA): $(desktop_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) sed '/^# Translators/d' < $< > $@ +endif matchdir = $(datadir)/engrampa match_DATA = packages.match @@ -21,7 +25,11 @@ appdata_in_in_files = engrampa.appdata.xml.in.in appdata_in_files = $(appdata_in_in_files:.xml.in.in=.xml.in) appdata_DATA = $(appdata_in_files:.xml.in=.xml) $(appdata_DATA): $(appdata_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif gsettingsschema_in_files = org.mate.engrampa.gschema.xml.in gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) diff --git a/help/Makefile.am b/help/Makefile.am index ab64d33..6181a96 100644 --- a/help/Makefile.am +++ b/help/Makefile.am @@ -10,9 +10,13 @@ HELP_MEDIA = \ figures/engrampa_uparrow.png # Add linguas to be ignored, e.g. IGNORE_HELP_LINGUAS = ca de es fr +if USE_NLS 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/src/main.c b/src/main.c index a9e297d..292f4b1 100644 --- a/src/main.c +++ b/src/main.c @@ -317,12 +317,16 @@ main (int argc, char **argv) program_argv0 = argv[0]; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ context = g_option_context_new (N_("- Create and modify an archive")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); diff --git a/src/server.c b/src/server.c index 1b906de..1ca6c4e 100644 --- a/src/server.c +++ b/src/server.c @@ -437,12 +437,16 @@ main (int argc, char *argv[]) GError *error = NULL; guint owner_id; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ context = g_option_context_new (N_("- Create and modify an archive")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (! g_option_context_parse (context, &argc, &argv, &error)) { -- cgit v1.2.1