summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-18 10:59:50 +0100
committerraveit65 <[email protected]>2021-02-24 16:05:39 +0100
commitd105267f775b4371a670f016c9fbce7e81b2632a (patch)
treed3085f4d43d7fdcb41d80636404ac15720388ce3
parent036594c5542272f719994a62a4663fce998e26f2 (diff)
downloadmate-session-manager-d105267f775b4371a670f016c9fbce7e81b2632a.tar.bz2
mate-session-manager-d105267f775b4371a670f016c9fbce7e81b2632a.tar.xz
build: allow users to disable gettext support (--disable-nls)
-rw-r--r--Makefile.am6
-rw-r--r--capplet/gsm-app-dialog.c2
-rw-r--r--capplet/main.c2
-rw-r--r--configure.ac5
-rw-r--r--data/Makefile.am4
-rw-r--r--mate-session/main.c3
-rw-r--r--po/POTFILES.in2
-rw-r--r--tools/mate-session-inhibit.c4
-rw-r--r--tools/mate-session-save.c2
9 files changed, 26 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 6d82efc..8083bc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,9 @@
+if USE_NLS
+PO_SUBDIR = po
+endif
+
SUBDIRS = \
- po \
+ $(PO_SUBDIR) \
mate-submodules \
mate-session \
capplet \
diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c
index 9759bac..831e800 100644
--- a/capplet/gsm-app-dialog.c
+++ b/capplet/gsm-app-dialog.c
@@ -185,7 +185,9 @@ setup_dialog (GsmAppDialog *dialog)
GError *error;
xml = gtk_builder_new ();
+#ifdef ENABLE_NLS
gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
error = NULL;
if (!gtk_builder_add_from_file (xml,
diff --git a/capplet/main.c b/capplet/main.c
index 30c2ac6..10f82e7 100644
--- a/capplet/main.c
+++ b/capplet/main.c
@@ -68,9 +68,11 @@ int main(int argc, char* argv[])
GError* error;
GtkWidget* dialog;
+#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
error = NULL;
diff --git a/configure.ac b/configure.ac
index def5524..0af4f01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,8 +17,10 @@ AC_STDC_HEADERS
AM_PROG_LIBTOOL
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-AM_GNU_GETTEXT_VERSION([0.19.8])
AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.19.8])
+AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])
+
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")
@@ -375,5 +377,6 @@ echo "
XSync support: ${have_xsync}
XTest support: ${have_xtest}
Build documentation: ${enable_docbook_docs}
+ Native Language support: ${USE_NLS}
"
diff --git a/data/Makefile.am b/data/Makefile.am
index fbee59d..c74a669 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -23,7 +23,11 @@ desktop_DATA += mate-wm.desktop
endif
%.desktop: %.desktop.in Makefile
+if USE_NLS
$(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
+else
+ $(AM_V_GEN) sed '/^# Translators/d' < $< > $@
+endif
gsettingsschema_in_files = org.mate.session.gschema.xml.in
gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
diff --git a/mate-session/main.c b/mate-session/main.c
index 56795ac..25fe52d 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -21,7 +21,6 @@
#include <config.h>
-#include <libintl.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
@@ -622,9 +621,11 @@ int main(int argc, char** argv)
gsm_util_init_error(TRUE, "%s", error->message);
}
+#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 363d3cc..c91c7fd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,5 +19,5 @@ mate-session/gsm-xsmp-client.c
mate-session/gsm-xsmp-server.c
mate-session/gsm-util.c
mate-session/main.c
-tools/mate-session-save.c
tools/mate-session-inhibit.c
+tools/mate-session-save.c
diff --git a/tools/mate-session-inhibit.c b/tools/mate-session-inhibit.c
index 6473735..77f12e3 100644
--- a/tools/mate-session-inhibit.c
+++ b/tools/mate-session-inhibit.c
@@ -24,7 +24,9 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#ifdef ENABLE_NLS
#include <locale.h>
+#endif /* ENABLE_NLS */
#include <glib.h>
#include <glib/gi18n.h>
@@ -149,10 +151,12 @@ int main (int argc, char *argv[])
g_set_prgname (prgname);
g_free (prgname);
+#ifdef ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
for (i = 1; i < argc; i++)
{
diff --git a/tools/mate-session-save.c b/tools/mate-session-save.c
index 31e302c..3b76373 100644
--- a/tools/mate-session-save.c
+++ b/tools/mate-session-save.c
@@ -206,9 +206,11 @@ int main(int argc, char* argv[])
int conflicting_options;
/* Initialize the i18n stuff */
+#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
error = NULL;