From bf09823fab35beee18936d570a50db6466d92d0f Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Mon, 11 Nov 2019 11:53:25 +0800 Subject: [PATCH] migrate from intltool to gettext --- Makefile.am | 10 +++-- configure.ac | 40 +++++++++--------- mate-terminal.appdata.xml.in | 6 +-- mate-terminal.desktop.in.in | 8 ++-- po/Makevars | 78 ++++++++++++++++++++++++++++++++++++ po/POTFILES.in | 17 ++++---- src/Makefile.am | 3 -- 7 files changed, 121 insertions(+), 41 deletions(-) create mode 100644 po/Makevars diff --git a/Makefile.am b/Makefile.am index 337d665..6022fc4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src po help +SUBDIRS = po src help ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} @@ -9,15 +9,17 @@ DISTCHECK_CONFIGURE_FLAGS = \ --disable-silent-rules \ CFLAGS='-Wno-deprecated-declarations' -@INTLTOOL_XML_RULE@ appdatadir = $(datadir)/metainfo appdata_in_files = mate-terminal.appdata.xml.in appdata_DATA = $(appdata_in_files:.xml.in=.xml) +$(appdata_DATA): $(appdata_in_files) + $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ desktopdir = $(datadir)/applications -desktop_in_files = @PACKAGE@.desktop.in.in +desktop_in_files = mate-terminal.desktop.in.in desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) -@INTLTOOL_DESKTOP_RULE@ +$(desktop_DATA): $(desktop_in_files) + $(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@ man_MANS = mate-terminal.1 diff --git a/configure.ac b/configure.ac index 5d219a7..08b10fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,17 +1,24 @@ -m4_define([gt_version_major],[1]) -m4_define([gt_version_minor],[23]) -m4_define([gt_version_micro],[0]) -m4_define([gt_version_extra],[]) -m4_define([gt_version],[gt_version_major().gt_version_minor().gt_version_micro()gt_version_extra]) +m4_define(mt_major_version, 1) +m4_define(mt_minor_version, 23) +m4_define(mt_micro_version, 0) +m4_define(mt_version, mt_major_version.mt_minor_version).mt_micro_version) -m4_define([gt_api_version],[0]) +m4_define(mt_api_version, 0) -AC_INIT([MATE Terminal],[gt_version],[https://mate-desktop.org],[mate-terminal]) +AC_INIT([mate-terminal],[mt_version], + [https://github.com/mate-desktop/mate-terminal/issues], + [mate-terminal], [https://mate-desktop.org]) AC_CONFIG_SRCDIR([src/terminal.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz check-news]) + +AC_SUBST(TERMINAL_MAJOR_VERSION, mt_major_version) +AC_SUBST(TERMINAL_MINOR_VERSION, mt_minor_version) +AC_SUBST(TERMINAL_MICRO_VERSION, mt_micro_version) +AC_SUBST(TERMINAL_API_VERSION, mt_api_version) + m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) if test -z "$enable_maintainer_mode"; then @@ -24,19 +31,12 @@ MATE_DEBUG_CHECK([no]) MATE_COMPILE_WARNINGS([yes]) #MATE_MAINTAINER_MODE_DEFINES -GETTEXT_PACKAGE=mate-terminal -AC_SUBST([GETTEXT_PACKAGE]) -AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) - AC_C_BIGENDIAN PKG_PROG_PKG_CONFIG AC_PROG_CC AC_HEADER_STDC AM_PROG_LIBTOOL -IT_PROG_INTLTOOL([0.50.1]) - -AM_GLIB_GNU_GETTEXT GLIB_REQUIRED=2.50.0 GIO_REQUIRED=2.50.0 @@ -114,12 +114,14 @@ YELP_HELP_INIT # **************************** -AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major]) -AC_SUBST([TERMINAL_MINOR_VERSION],[gt_version_minor]) -AC_SUBST([TERMINAL_MICRO_VERSION],[gt_version_micro]) -AC_SUBST([TERMINAL_API_VERSION],[gt_api_version]) - # **************************** +AM_GNU_GETTEXT_VERSION([0.19.8]) +AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8]) +AM_GNU_GETTEXT([external]) + +GETTEXT_PACKAGE=mate-terminal +AC_SUBST([GETTEXT_PACKAGE]) +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) AC_CONFIG_FILES([ Makefile diff --git a/mate-terminal.appdata.xml.in b/mate-terminal.appdata.xml.in index d523827..dee6309 100644 --- a/mate-terminal.appdata.xml.in +++ b/mate-terminal.appdata.xml.in @@ -5,8 +5,8 @@ CC0-1.0 GPL-3.0+ MATE Terminal - <_summary>A terminal emulator for the MATE desktop environment - <_description> + A terminal emulator for the MATE desktop environment +

MATE Terminal is a terminal emulation application that you can use to access a UNIX shell in the MATE environment. MATE Terminal emulates @@ -19,7 +19,7 @@ If you would like to know more about MATE and MATE Terminal, please visit the project's home page.

- +
diff --git a/mate-terminal.desktop.in.in b/mate-terminal.desktop.in.in index a0e9401..cd6ba31 100644 --- a/mate-terminal.desktop.in.in +++ b/mate-terminal.desktop.in.in @@ -1,9 +1,10 @@ [Desktop Entry] -_Name=MATE Terminal -_GenericName=Terminal -_Comment=Use the command line +Name=MATE Terminal +GenericName=Terminal +Comment=Use the command line TryExec=mate-terminal Exec=mate-terminal +# Translators: Do NOT translate or transliterate this text (this is an icon file name)! Icon=utilities-terminal Type=Application X-MATE-DocPath=mate-terminal/index.html @@ -11,6 +12,7 @@ X-MATE-Bugzilla-Bugzilla=MATE X-MATE-Bugzilla-Product=mate-terminal X-MATE-Bugzilla-Component=BugBuddyBugs X-MATE-Bugzilla-Version=@VERSION@ +# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! Categories=System;GTK;Utility;TerminalEmulator; StartupNotify=true diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..8d493dc --- /dev/null +++ b/po/Makevars @@ -0,0 +1,78 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +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 --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 +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = MATE Desktop Environment team + +# This tells whether or not to prepend "GNU " prefix to the package +# name that gets inserted into the header of the $(DOMAIN).pot file. +# 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 = + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = + +# These options get passed to msginit. +# If you want to disable line wrapping when writing PO files, add +# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and +# MSGINIT_OPTIONS. +MSGINIT_OPTIONS = + +# This tells whether or not to regenerate a PO file when $(DOMAIN).pot +# has changed. Possible values are "yes" and "no". Set this to no if +# the POT file is checked in the repository and the version control +# program ignores timestamps. +PO_DEPENDS_ON_POT = yes + +# This tells whether or not to forcibly update $(DOMAIN).pot and +# regenerate PO files on "make dist". Possible values are "yes" and +# "no". Set this to no if the POT file and PO files are maintained +# externally. +DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/po/POTFILES.in b/po/POTFILES.in index 05f3ec3..f4aa963 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,18 +1,17 @@ -[encoding: UTF-8] # List of source files containing translatable strings. # Please keep this file sorted alphabetically. mate-terminal.appdata.xml.in mate-terminal.desktop.in.in src/eggsmclient.c -[type: gettext/gsettings]src/org.mate.terminal.gschema.xml.in +src/org.mate.terminal.gschema.xml.in src/profile-editor.c -[type: gettext/glade]src/encodings-dialog.ui -[type: gettext/glade]src/find-dialog.ui -[type: gettext/glade]src/keybinding-editor.ui -[type: gettext/glade]src/profile-manager.ui -[type: gettext/glade]src/profile-new-dialog.ui -[type: gettext/glade]src/profile-preferences.ui -[type: gettext/glade]src/skey-challenge.ui +src/encodings-dialog.ui +src/find-dialog.ui +src/keybinding-editor.ui +src/profile-manager.ui +src/profile-new-dialog.ui +src/profile-preferences.ui +src/skey-challenge.ui src/skey-popup.c src/terminal-accels.c src/terminal-app.c diff --git a/src/Makefile.am b/src/Makefile.am index 85a360e..c102007 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -149,7 +149,6 @@ terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(she gsettingsschema_in_files = org.mate.terminal.gschema.xml.in gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) .PRECIOUS: $(gsettings_SCHEMAS) -@INTLTOOL_XML_NOMERGE_RULE@ CLEANFILES = \ stamp-terminal-type-builtins.h \ @@ -182,6 +181,4 @@ EXTRA_DIST = \ @GSETTINGS_RULES@ -@INTLTOOL_SCHEMAS_RULE@ - -include $(top_srcdir)/git.mk