summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-18 12:25:55 +0100
committerraveit65 <[email protected]>2021-02-24 16:29:19 +0100
commit59ce19333e004c55645951beb850dc5a3abd5444 (patch)
tree9678914f86d8463a1d50e66ebe284dcce7986053
parentd8d3f21b1a6e1cc9a4e82ff9c9a6e2aded0394bd (diff)
downloadmate-notification-daemon-59ce19333e004c55645951beb850dc5a3abd5444.tar.bz2
mate-notification-daemon-59ce19333e004c55645951beb850dc5a3abd5444.tar.xz
build: allow users to disable gettext support (--disable-nls)
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac4
-rw-r--r--data/Makefile.am8
-rw-r--r--src/capplet/mate-notification-applet.c4
-rw-r--r--src/capplet/mate-notification-properties.c2
5 files changed, 22 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index c436a21..4f4dbfb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,8 @@
-SUBDIRS = po data src
+if USE_NLS
+PO_SUBDIR = po
+endif
+
+SUBDIRS = $(PO_SUBDIR) data src
# Point to our macro directory and pick up user flags from the environment
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
diff --git a/configure.ac b/configure.ac
index af9be0d..a544d39 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,9 +75,10 @@ dnl ---------------------------------------------------------------------------
dnl i18n stuff
dnl ---------------------------------------------------------------------------
+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"])
AC_SUBST([GETTEXT_PACKAGE], [mate-notification-daemon])
AC_DEFINE([GETTEXT_PACKAGE], [PACKAGE_TARNAME], [Define to the gettext package name.])
@@ -314,6 +315,7 @@ echo "
warning flags: ${WARN_CFLAGS}
Wayland support: ${have_wayland}
X11 support: ${have_x11}
+ Native Language support: ${USE_NLS}
dbus-1 system.d $DBUS_SYS_DIR
dbus-1 services $DBUS_SERVICES_DIR
diff --git a/data/Makefile.am b/data/Makefile.am
index be9a8b7..a666d7a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -21,14 +21,22 @@ applet_DATA = org.mate.applets.MateNotificationApplet.mate-panel-applet
applet_in_files = $(applet_DATA:.mate-panel-applet=.desktop.in)
$(applet_DATA): $(applet_in_files)
+if USE_NLS
$(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
+else
+ $(AM_V_GEN) cp -f $< $@
+endif
desktopdir = $(datadir)/applications
desktop_DATA = mate-notification-properties.desktop
desktop_in_files = $(desktop_DATA:.desktop=.desktop.in)
$(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
gsettings_SCHEMAS = org.mate.NotificationDaemon.gschema.xml
gsettingsschema_in_files = $(gsettings_SCHEMAS:=.in)
diff --git a/src/capplet/mate-notification-applet.c b/src/capplet/mate-notification-applet.c
index 04a799d..ec10acc 100644
--- a/src/capplet/mate-notification-applet.c
+++ b/src/capplet/mate-notification-applet.c
@@ -166,9 +166,11 @@ applet_main (MatePanelApplet *applet_widget)
MateNotificationApplet *applet;
GtkWidget *box;
+#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
g_set_application_name (_("Do Not Disturb"));
gtk_window_set_default_icon_name ("mate-notification-properties");
@@ -202,7 +204,9 @@ applet_main (MatePanelApplet *applet_widget)
/* set up context menu */
applet->action_group = gtk_action_group_new ("Do Not Disturb Actions");
+#ifdef ENABLE_NLS
gtk_action_group_set_translation_domain (applet->action_group, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_action_group_add_actions (applet->action_group, applet_menu_actions,
G_N_ELEMENTS (applet_menu_actions), applet);
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index 154029d..7d43455 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -511,9 +511,11 @@ int main(int argc, char** argv)
{
NotificationAppletDialog dialog = {NULL, }; /* <- ? */
+#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, NOTIFICATION_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
gtk_init(&argc, &argv);