From e50a1907e04a320bf9e054182b8dbeb4c52eb076 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 13 Feb 2021 12:32:06 +0100 Subject: build: allow users to disable gettext support (--disable-nls) --- capplets/about-me/Makefile.am | 4 ++++ capplets/accessibility/at-properties/Makefile.am | 4 ++++ capplets/appearance/data/Makefile.am | 9 ++++++++- capplets/appearance/mate-wp-xml.c | 8 +++++++- capplets/common/capplet-util.c | 6 ++++-- capplets/default-applications/Makefile.am | 4 ++++ capplets/display/Makefile.am | 8 ++++++++ capplets/display/mate-display-properties-install-systemwide.c | 4 ++++ capplets/keybindings/Makefile.am | 9 +++++++++ capplets/keyboard/Makefile.am | 4 ++++ capplets/mouse/Makefile.am | 4 ++++ capplets/network/Makefile.am | 4 ++++ capplets/time-admin/data/Makefile.am | 7 +++++-- capplets/windows/Makefile.am | 4 ++++ 14 files changed, 73 insertions(+), 6 deletions(-) (limited to 'capplets') diff --git a/capplets/about-me/Makefile.am b/capplets/about-me/Makefile.am index 0af42ff5..47391e5a 100644 --- a/capplets/about-me/Makefile.am +++ b/capplets/about-me/Makefile.am @@ -31,7 +31,11 @@ mate_about_me_LDFLAGS = -export-dynamic desktopdir = $(datadir)/applications desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif include $(top_srcdir)/gla11y.mk diff --git a/capplets/accessibility/at-properties/Makefile.am b/capplets/accessibility/at-properties/Makefile.am index e8103621..3be5d9b0 100644 --- a/capplets/accessibility/at-properties/Makefile.am +++ b/capplets/accessibility/at-properties/Makefile.am @@ -18,7 +18,11 @@ Desktop_in_files = mate-at-properties.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif pixmapdir = $(pkgdatadir)/pixmaps pixmap_DATA = \ diff --git a/capplets/appearance/data/Makefile.am b/capplets/appearance/data/Makefile.am index bbb1919e..68884643 100644 --- a/capplets/appearance/data/Makefile.am +++ b/capplets/appearance/data/Makefile.am @@ -23,16 +23,23 @@ desktop_in_files = \ mate-theme-installer.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) %.desktop: %.desktop.in +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) sed '/^# Translators/d' < $< > $@ +endif xml_in_files = \ mate-theme-package.xml.in mimedir = $(datadir)/mime/packages mime_DATA = $(xml_in_files:.xml.in=.xml) - $(mime_DATA): $(xml_in_files) +if USE_NLS $(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif install-data-hook: if ENABLE_UPDATE_MIMEDB diff --git a/capplets/appearance/mate-wp-xml.c b/capplets/appearance/mate-wp-xml.c index fb8ce905..48bc708e 100644 --- a/capplets/appearance/mate-wp-xml.c +++ b/capplets/appearance/mate-wp-xml.c @@ -124,10 +124,12 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename) xmlNode* list; xmlNode* wpa; xmlChar* nodelang; +#ifdef ENABLE_NLS const char* const* syslangs; + gint i; +#endif /* ENABLE_NLS */ GdkRGBA color1; GdkRGBA color2; - gint i; wplist = xmlParseFile(filename); @@ -136,7 +138,9 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename) return; } +#ifdef ENABLE_NLS syslangs = g_get_language_names(); +#endif /* ENABLE_NLS */ root = xmlDocGetRootElement(wplist); @@ -193,6 +197,7 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename) { wp->name = g_strdup (g_strstrip ((char *)wpa->last->content)); } +#ifdef ENABLE_NLS else { for (i = 0; syslangs[i] != NULL; i++) @@ -205,6 +210,7 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename) } } } +#endif /* ENABLE_NLS */ xmlFree (nodelang); } diff --git a/capplets/common/capplet-util.c b/capplets/common/capplet-util.c index c78ab2d7..a5615a06 100644 --- a/capplets/common/capplet-util.c +++ b/capplets/common/capplet-util.c @@ -22,7 +22,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -242,10 +242,12 @@ capplet_init (GOptionContext *context, bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); -#endif +#endif /* ENABLE_NLS */ if (context) { +#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, &err)) { diff --git a/capplets/default-applications/Makefile.am b/capplets/default-applications/Makefile.am index 8aac00ff..4644cd44 100644 --- a/capplets/default-applications/Makefile.am +++ b/capplets/default-applications/Makefile.am @@ -23,7 +23,11 @@ desktopdir = $(datadir)/applications Desktop_in_files = mate-default-applications-properties.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = mate-default-applications.pc diff --git a/capplets/display/Makefile.am b/capplets/display/Makefile.am index 7ca1180f..d25940b3 100644 --- a/capplets/display/Makefile.am +++ b/capplets/display/Makefile.am @@ -38,14 +38,22 @@ dist_polkit_policy_DATA = \ org.mate.randr.policy %.policy: %.policy.in +if USE_NLS $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif desktopdir = $(datadir)/applications Desktop_in_files = mate-display-properties.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif AM_CPPFLAGS = \ $(WARN_CFLAGS) \ diff --git a/capplets/display/mate-display-properties-install-systemwide.c b/capplets/display/mate-display-properties-install-systemwide.c index 2d074eb8..993791c1 100644 --- a/capplets/display/mate-display-properties-install-systemwide.c +++ b/capplets/display/mate-display-properties-install-systemwide.c @@ -26,7 +26,9 @@ #include "config.h" #include +#ifdef ENABLE_NLS #include +#endif /* ENABLE_NLS */ #include #include #include @@ -138,10 +140,12 @@ main (int argc, char **argv) int dest_fd; char template[100]; +#ifdef ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ /* We only run as root */ uid = getuid (); diff --git a/capplets/keybindings/Makefile.am b/capplets/keybindings/Makefile.am index f3e500c5..1c27004b 100644 --- a/capplets/keybindings/Makefile.am +++ b/capplets/keybindings/Makefile.am @@ -23,14 +23,23 @@ Desktop_in_files = mate-keybinding.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif xmldir = $(pkgdatadir)/keybindings xml_in_files = 00-multimedia-key.xml.in 01-desktop-key.xml.in xml_DATA = $(xml_in_files:.xml.in=.xml) %.xml: %.xml.in +if USE_NLS $(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = mate-keybindings.pc diff --git a/capplets/keyboard/Makefile.am b/capplets/keyboard/Makefile.am index 8c54ef8d..edd775c5 100644 --- a/capplets/keyboard/Makefile.am +++ b/capplets/keyboard/Makefile.am @@ -34,7 +34,11 @@ Desktop_in_files = mate-keyboard.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif mate-keyboard-properties-resources.h mate-keyboard-properties-resources.c: org.mate.mcc.keyboard.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.keyboard.gresource.xml) $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name keyboard $< diff --git a/capplets/mouse/Makefile.am b/capplets/mouse/Makefile.am index dfeb69e1..0fee735e 100644 --- a/capplets/mouse/Makefile.am +++ b/capplets/mouse/Makefile.am @@ -21,7 +21,11 @@ Desktop_in_files = mate-settings-mouse.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif mate-mouse-properties-resources.h mate-mouse-properties-resources.c: org.mate.mcc.mouse.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.mouse.gresource.xml) $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name mouse $< diff --git a/capplets/network/Makefile.am b/capplets/network/Makefile.am index e36a3dda..364d77e4 100644 --- a/capplets/network/Makefile.am +++ b/capplets/network/Makefile.am @@ -18,7 +18,11 @@ desktop_in_files = mate-network-properties.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif mate-network-properties-resources.h mate-network-properties-resources.c: org.mate.mcc.network.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.network.gresource.xml) $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name network $< diff --git a/capplets/time-admin/data/Makefile.am b/capplets/time-admin/data/Makefile.am index f8d5c524..dbe2572e 100644 --- a/capplets/time-admin/data/Makefile.am +++ b/capplets/time-admin/data/Makefile.am @@ -28,10 +28,13 @@ desktop_in_files = mate-time-admin.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) $(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) sed '/^# Translators/d' < $< > $@ +endif CLEANFILES = $(desktop_DATA) -EXTRA_DIST = \ - $(desktop_in_files) +EXTRA_DIST = $(desktop_in_files) -include $(top_srcdir)/git.mk diff --git a/capplets/windows/Makefile.am b/capplets/windows/Makefile.am index 11777e7b..3104b4b8 100644 --- a/capplets/windows/Makefile.am +++ b/capplets/windows/Makefile.am @@ -20,7 +20,11 @@ mate-window-properties-resources.h mate-window-properties-resources.c: org.mate. $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name window_properties $< $(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) sed '/^# Translators/d' < $< > $@ +endif AM_CPPFLAGS = \ $(WARN_CFLAGS) \ -- cgit v1.2.1