diff options
author | rbuj <[email protected]> | 2021-02-08 13:36:28 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-02-10 23:58:25 +0100 |
commit | 66de6ed56647df275f2844eb6106349932991579 (patch) | |
tree | 56b68e1244af645727ece13032f2ba89fe6cb68f | |
parent | 6b159d0665c67c3c78c2968673e24bf45c2430d2 (diff) | |
download | atril-66de6ed56647df275f2844eb6106349932991579.tar.bz2 atril-66de6ed56647df275f2844eb6106349932991579.tar.xz |
build: allow users to disable gettext support (--disable-nls)
-rw-r--r-- | Makefile.am | 7 | ||||
-rw-r--r-- | backend/comics/Makefile.am | 4 | ||||
-rw-r--r-- | backend/djvu/Makefile.am | 4 | ||||
-rw-r--r-- | backend/dvi/Makefile.am | 4 | ||||
-rw-r--r-- | backend/epub/Makefile.am | 6 | ||||
-rw-r--r-- | backend/pdf/Makefile.am | 4 | ||||
-rw-r--r-- | backend/pixbuf/Makefile.am | 4 | ||||
-rw-r--r-- | backend/ps/Makefile.am | 4 | ||||
-rw-r--r-- | backend/tiff/Makefile.am | 4 | ||||
-rw-r--r-- | backend/xps/Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | data/Makefile.am | 8 | ||||
-rw-r--r-- | help/Makefile.am | 4 | ||||
-rw-r--r-- | libdocument/ev-document.h | 7 | ||||
-rw-r--r-- | libdocument/ev-init.c | 7 | ||||
-rw-r--r-- | po/Makevars | 4 | ||||
-rw-r--r-- | previewer/ev-previewer.c | 4 | ||||
-rw-r--r-- | properties/Makefile.am | 6 | ||||
-rw-r--r-- | shell/main.c | 4 |
19 files changed, 74 insertions, 19 deletions
diff --git a/Makefile.am b/Makefile.am index 719d155d..68950e21 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = \ - po \ cut-n-paste \ data \ libdocument \ @@ -12,6 +11,10 @@ SUBDIRS = \ shell \ help +if USE_NLS + SUBDIRS += po +endif + if ENABLE_TESTS SUBDIRS += test endif @@ -38,7 +41,7 @@ header_DATA = \ atril-view.h \ $(NULL) -# Applications +# Applications EXTRA_DIST = \ $(header_DATA) \ autogen.sh \ diff --git a/backend/comics/Makefile.am b/backend/comics/Makefile.am index 49821093..b27f9b85 100644 --- a/backend/comics/Makefile.am +++ b/backend/comics/Makefile.am @@ -23,7 +23,11 @@ libcomicsdocument_la_LIBADD = \ backend_in_files = comicsdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/djvu/Makefile.am b/backend/djvu/Makefile.am index 1f28ae76..a25134e8 100644 --- a/backend/djvu/Makefile.am +++ b/backend/djvu/Makefile.am @@ -28,7 +28,11 @@ libdjvudocument_la_LIBADD = \ backend_in_files = djvudocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/dvi/Makefile.am b/backend/dvi/Makefile.am index c94c10ad..26571c6f 100644 --- a/backend/dvi/Makefile.am +++ b/backend/dvi/Makefile.am @@ -36,7 +36,11 @@ endif backend_in_files = dvidocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/epub/Makefile.am b/backend/epub/Makefile.am index 9eca6519..e1dee6ca 100644 --- a/backend/epub/Makefile.am +++ b/backend/epub/Makefile.am @@ -15,7 +15,7 @@ backend_LTLIBRARIES = libepubdocument.la libepubdocument_la_SOURCES = \ epub-document.c \ - epub-document.h + epub-document.h libepubdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) libepubdocument_la_LIBADD = \ @@ -29,7 +29,11 @@ backend_in_files = epubdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/pdf/Makefile.am b/backend/pdf/Makefile.am index e51dfdca..4934a31d 100644 --- a/backend/pdf/Makefile.am +++ b/backend/pdf/Makefile.am @@ -30,6 +30,10 @@ EXTRA_DIST = $(backend_in_files) CLEANFILES = $(backend_DATA) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif -include $(top_srcdir)/git.mk diff --git a/backend/pixbuf/Makefile.am b/backend/pixbuf/Makefile.am index 194c6be5..2c9a742b 100644 --- a/backend/pixbuf/Makefile.am +++ b/backend/pixbuf/Makefile.am @@ -21,7 +21,11 @@ libpixbufdocument_la_LIBADD = \ backend_in_files = pixbufdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/ps/Makefile.am b/backend/ps/Makefile.am index 0cac11ff..7e431376 100644 --- a/backend/ps/Makefile.am +++ b/backend/ps/Makefile.am @@ -24,7 +24,11 @@ backend_in_files = psdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/tiff/Makefile.am b/backend/tiff/Makefile.am index 1be66eca..5ceaa69c 100644 --- a/backend/tiff/Makefile.am +++ b/backend/tiff/Makefile.am @@ -24,7 +24,11 @@ libtiffdocument_la_LIBADD = \ backend_in_files = tiffdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/xps/Makefile.am b/backend/xps/Makefile.am index b0be0664..b2b2e5c7 100644 --- a/backend/xps/Makefile.am +++ b/backend/xps/Makefile.am @@ -22,7 +22,11 @@ libxpsdocument_la_LIBADD = \ backend_in_files = xpsdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/configure.ac b/configure.ac index 0fe2eaed..096fce8e 100644 --- a/configure.ac +++ b/configure.ac @@ -74,9 +74,10 @@ dnl FIXME: remove this when required gtk+ >= 2.19.7 DISABLE_DEPRECATED= AC_SUBST([DISABLE_DEPRECATED]) +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"]) GETTEXT_PACKAGE=AC_PACKAGE_NAME AC_SUBST(GETTEXT_PACKAGE) @@ -796,6 +797,7 @@ Configure summary: Gtk-Doc Support.....: $enable_gtk_doc Debug mode..........: $enable_debug GObj. Introspection.: $enable_introspection + Use NLS.............: ${USE_NLS} Tests...............: $enable_tests PDF Backend.........: $enable_pdf diff --git a/data/Makefile.am b/data/Makefile.am index f6a99571..f924481b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -25,7 +25,11 @@ desktopdir = $(datadir)/applications desktop_in_files = atril.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) cp -f $< $@ +endif # # DBus servide file @@ -49,7 +53,11 @@ appdata_in_in_files = atril.appdata.xml.in.in appdata_in_files = $(appdata_in_in_files:.appdata.xml.in.in=.appdata.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 # # GSettings schema diff --git a/help/Makefile.am b/help/Makefile.am index a711b85e..7e0f9fc3 100644 --- a/help/Makefile.am +++ b/help/Makefile.am @@ -7,9 +7,13 @@ HELP_FILES = index.docbook legal.xml HELP_MEDIA = figures/atril_start_window.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/libdocument/ev-document.h b/libdocument/ev-document.h index 7fb1bf2f..67f53abb 100644 --- a/libdocument/ev-document.h +++ b/libdocument/ev-document.h @@ -27,6 +27,9 @@ #ifndef EV_DOCUMENT_H #define EV_DOCUMENT_H +#include <config.h> +#include <glib/gi18n-lib.h> + #include <glib-object.h> #include <glib.h> #include <gmodule.h> @@ -277,10 +280,6 @@ register_atril_backend (GTypeModule *module) \ (GInstanceInitFunc) backend_name##_init \ }; \ \ - /* Initialise the i18n stuff */ \ - bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); \ - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \ - \ g_define_type_id = g_type_module_register_type (module, \ EV_TYPE_DOCUMENT, \ #BackendName, \ diff --git a/libdocument/ev-init.c b/libdocument/ev-init.c index 15cb555e..21aca668 100644 --- a/libdocument/ev-init.c +++ b/libdocument/ev-init.c @@ -38,8 +38,7 @@ ev_get_locale_dir (void) /** * ev_init: * - * Initializes the atril document library, and binds the atril - * gettext domain. + * Initializes the atril document library. * * You must call this before calling any other function in the atril * document library. @@ -54,10 +53,6 @@ ev_init (void) if (ev_init_count++ > 0) return have_backends; - /* set up translation catalog */ - bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir ()); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - _ev_debug_init (); _ev_file_helpers_init (); have_backends = _ev_backends_manager_init (); diff --git a/po/Makevars b/po/Makevars index f32fa197..8a3d336c 100644 --- a/po/Makevars +++ b/po/Makevars @@ -8,7 +8,7 @@ subdir = po top_builddir = .. # These options get passed to xgettext. -XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --keyword=Description --keyword=TypeDescription --add-comments=Translators: +XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --keyword=Description --keyword=TypeDescription --keyword=Copyright --add-comments=Translators: # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding @@ -25,7 +25,7 @@ COPYRIGHT_HOLDER = MATE Desktop Environment team # Possible values are "yes", "no", or empty. If it is empty, try to # detect it automatically by scanning the files in $(top_srcdir) for # "GNU packagename" string. -PACKAGE_GNU = +PACKAGE_GNU = no # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c index e96db773..22c7ce4c 100644 --- a/previewer/ev-previewer.c +++ b/previewer/ev-previewer.c @@ -102,10 +102,12 @@ main (gint argc, gchar **argv) bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir()); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); -#endif +#endif /* ENABLE_NLS */ context = g_option_context_new (_("MATE Document Previewer")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); diff --git a/properties/Makefile.am b/properties/Makefile.am index 74005f0a..5db27bc8 100644 --- a/properties/Makefile.am +++ b/properties/Makefile.am @@ -35,7 +35,11 @@ extension_in_in_files = libatril-properties-page.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=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 EXTRA_DIST = $(extension_in_in_files) diff --git a/shell/main.c b/shell/main.c index 7a4658be..79b92524 100644 --- a/shell/main.c +++ b/shell/main.c @@ -231,10 +231,12 @@ main (int argc, char *argv[]) bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir()); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); -#endif +#endif /* ENABLE_NLS */ context = g_option_context_new (N_("MATE Document Viewer")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE); g_option_context_add_group (context, egg_sm_client_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); |