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) --- font-viewer/Makefile.am | 14 ++++++++++---- font-viewer/font-thumbnailer.c | 9 ++++++--- font-viewer/font-view.c | 2 ++ 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'font-viewer') diff --git a/font-viewer/Makefile.am b/font-viewer/Makefile.am index 9dbaee9c..d2ea43ca 100644 --- a/font-viewer/Makefile.am +++ b/font-viewer/Makefile.am @@ -35,7 +35,11 @@ desktopdir = $(datadir)/applications desktop_in_files = mate-font-viewer.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 install-data-local: install-desktop-database @@ -45,11 +49,13 @@ install-desktop-database: install-desktopDATA uninstall-local: rm -f $(DESTDIR)$(desktopdir)/mimeinfo.cache -CLEANFILES = $(desktop_DATA) \ - $(schemas_DATA) $(directory_DATA) +CLEANFILES = \ + $(desktop_DATA) \ + $(schemas_DATA) \ + $(directory_DATA) EXTRA_DIST = \ - $(thumbnailer_DATA) \ - $(desktop_in_files) + $(desktop_in_files) \ + $(thumbnailer_DATA) -include $(top_srcdir)/git.mk diff --git a/font-viewer/font-thumbnailer.c b/font-viewer/font-thumbnailer.c index 9e9d344c..6014f30d 100644 --- a/font-viewer/font-thumbnailer.c +++ b/font-viewer/font-thumbnailer.c @@ -21,11 +21,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include +#ifdef ENABLE_NLS #include +#endif /* ENABLE_NLS */ #include #include #include FT_FREETYPE_H @@ -196,11 +198,12 @@ main (int argc, { NULL } }; +#ifdef ENABLE_NLS + setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - - setlocale (LC_ALL, ""); +#endif /* ENABLE_NLS */ context = g_option_context_new (NULL); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c index ad9c2078..8d40cdcd 100644 --- a/font-viewer/font-view.c +++ b/font-viewer/font-view.c @@ -944,9 +944,11 @@ main (int argc, GApplication *app; gint retval; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ app = font_view_application_new (); retval = g_application_run (app, argc, argv); -- cgit v1.2.1