From 5582a7d8c8a4c37678a3f09adaca6a781d1ffbf7 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Sat, 6 Apr 2024 21:41:54 +0800 Subject: [PATCH] build: Switch from intltool to gettext See https://gitlab.xfce.org/xfce/xfce4-dev-tools/-/issues/41. --- .gitignore | 16 +++++++- Makefile.am | 12 ++---- autogen.sh | 2 +- configure.ac.in | 8 +++- po/LINGUAS | 59 ++++++++++++++++++++++++++ po/Makevars | 80 ++++++++++++++++++++++++++++++++++++ po/POTFILES.in | 4 +- xfce4-taskmanager.desktop.in | 6 +-- 8 files changed, 168 insertions(+), 19 deletions(-) create mode 100644 po/LINGUAS create mode 100644 po/Makevars diff --git a/.gitignore b/.gitignore index f97b7e3..89a08fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,15 @@ po/*.gmo -po/.intltool-merge-cache* *Makefile *Makefile.in po/Makefile.in.in +ABOUT-NLS +ChangeLog POTFILES stamp* */.deps .libs +*~ +*.bz2 *.orig *.o *.lo @@ -16,7 +19,6 @@ stamp* configure config.* configure.ac -intltool* mkinstalldirs missing compile @@ -26,6 +28,16 @@ libtool depcomp aclocal.m4 m4/ +po/Makevars.template +po/Rules-quot +po/boldquot.sed +po/en@boldquot.header +po/en@quot.header +po/insert-header.sin +po/quot.sed +po/remove-potcdate.sed +po/remove-potcdate.sin +po/xfce4-taskmanager.pot autom4te.cache *.desktop INSTALL diff --git a/Makefile.am b/Makefile.am index da1cf81..99f40a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,23 +8,17 @@ SUBDIRS = \ desktopdir = $(datadir)/applications desktop_in_files = xfce4-taskmanager.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) -@INTLTOOL_DESKTOP_RULE@ + +xfce4-taskmanager.desktop: xfce4-taskmanager.desktop.in + $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@ ChangeLog: Makefile ChangeLog-git.sh > $(srcdir)/ChangeLog || touch $(srcdir)/ChangeLog EXTRA_DIST = \ - README.md \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ $(desktop_in_files) DISTCLEANFILES = \ - intltool-extract \ - intltool-merge \ - intltool-update \ - po/.intltool-merge-cache.lock \ $(desktop_DATA) # vi:set ts=8 sw=8 noet ai nocindent syntax=automake: diff --git a/autogen.sh b/autogen.sh index e97d7b1..11c6900 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,5 +10,5 @@ EOF exit 1 } -XDT_AUTOGEN_REQUIRED_VERSION="4.14.0" \ +XDT_AUTOGEN_REQUIRED_VERSION="4.17.0" \ exec xdt-autogen $@ diff --git a/configure.ac.in b/configure.ac.in index 715c619..7af514c 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -49,7 +49,6 @@ AC_PROG_CC() AM_PROG_CC_C_O() LT_PATH_LD([]) AC_PROG_INSTALL() -IT_PROG_INTLTOOL() dnl ************************************ dnl *** Checks for library functions *** @@ -64,7 +63,12 @@ AC_CHECK_HEADERS([stdlib.h string.h]) dnl ****************************** dnl *** Check for i18n support *** dnl ****************************** -XDT_I18N([@LINGUAS@]) +GETTEXT_PACKAGE="$PACKAGE" +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain]) +AC_SUBST([GETTEXT_PACKAGE]) + +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.19.8]) dnl *********************************** dnl *** Check for required packages *** diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..8ac2dc9 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,59 @@ +ar +ast +az +be +bg +ca +cs +da +de +el +en_AU +en_GB +es +et +eu +fa_IR +fi +fr +gl +he +hr +hu +hy_AM +hye +id +ie +is +it +ja +kk +ko +lt +lv +ms +nb +nl +oc +pa +pl +pt_BR +pt +ru +si +sk +sl +sq +sr +sv +te +th +tr +ug +uk +ur_PK +ur +vi +zh_CN +zh_HK +zh_TW diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..6a5044a --- /dev/null +++ b/po/Makevars @@ -0,0 +1,80 @@ +# 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 + +# 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 = The Xfce development 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 = no + +# 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 = no + +# 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 = no diff --git a/po/POTFILES.in b/po/POTFILES.in index a9bf561..b00e28d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -5,8 +5,8 @@ src/process-monitor.c src/process-statusbar.c src/process-tree-view.c src/process-window.c -[type: gettext/glade]src/process-window.ui +src/process-window.ui src/settings.c src/settings-dialog.c -[type: gettext/glade]src/settings-dialog.ui +src/settings-dialog.ui src/task-manager.c diff --git a/xfce4-taskmanager.desktop.in b/xfce4-taskmanager.desktop.in index c1c7daf..9862d0c 100644 --- a/xfce4-taskmanager.desktop.in +++ b/xfce4-taskmanager.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] -_Name=Task Manager -_Comment=Easy to use application to monitor system resources -_GenericName=Task Manager +Name=Task Manager +Comment=Easy to use application to monitor system resources +GenericName=Task Manager Exec=xfce4-taskmanager Icon=org.xfce.taskmanager Terminal=false