build: Switch from intltool to gettext

See https://gitlab.xfce.org/xfce/xfce4-dev-tools/-/issues/41.
This commit is contained in:
Bobby Rong
2024-04-06 21:41:54 +08:00
parent fe29b2e1d1
commit 5582a7d8c8
8 changed files with 168 additions and 19 deletions

16
.gitignore vendored
View File

@@ -1,12 +1,15 @@
po/*.gmo po/*.gmo
po/.intltool-merge-cache*
*Makefile *Makefile
*Makefile.in *Makefile.in
po/Makefile.in.in po/Makefile.in.in
ABOUT-NLS
ChangeLog
POTFILES POTFILES
stamp* stamp*
*/.deps */.deps
.libs .libs
*~
*.bz2
*.orig *.orig
*.o *.o
*.lo *.lo
@@ -16,7 +19,6 @@ stamp*
configure configure
config.* config.*
configure.ac configure.ac
intltool*
mkinstalldirs mkinstalldirs
missing missing
compile compile
@@ -26,6 +28,16 @@ libtool
depcomp depcomp
aclocal.m4 aclocal.m4
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 autom4te.cache
*.desktop *.desktop
INSTALL INSTALL

View File

@@ -8,23 +8,17 @@ SUBDIRS = \
desktopdir = $(datadir)/applications desktopdir = $(datadir)/applications
desktop_in_files = xfce4-taskmanager.desktop.in desktop_in_files = xfce4-taskmanager.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) 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: Makefile
ChangeLog-git.sh > $(srcdir)/ChangeLog || touch $(srcdir)/ChangeLog ChangeLog-git.sh > $(srcdir)/ChangeLog || touch $(srcdir)/ChangeLog
EXTRA_DIST = \ EXTRA_DIST = \
README.md \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
$(desktop_in_files) $(desktop_in_files)
DISTCLEANFILES = \ DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
po/.intltool-merge-cache.lock \
$(desktop_DATA) $(desktop_DATA)
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake: # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

View File

@@ -10,5 +10,5 @@ EOF
exit 1 exit 1
} }
XDT_AUTOGEN_REQUIRED_VERSION="4.14.0" \ XDT_AUTOGEN_REQUIRED_VERSION="4.17.0" \
exec xdt-autogen $@ exec xdt-autogen $@

View File

@@ -49,7 +49,6 @@ AC_PROG_CC()
AM_PROG_CC_C_O() AM_PROG_CC_C_O()
LT_PATH_LD([]) LT_PATH_LD([])
AC_PROG_INSTALL() AC_PROG_INSTALL()
IT_PROG_INTLTOOL()
dnl ************************************ dnl ************************************
dnl *** Checks for library functions *** dnl *** Checks for library functions ***
@@ -64,7 +63,12 @@ AC_CHECK_HEADERS([stdlib.h string.h])
dnl ****************************** dnl ******************************
dnl *** Check for i18n support *** dnl *** Check for i18n support ***
dnl ****************************** 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 ***********************************
dnl *** Check for required packages *** dnl *** Check for required packages ***

59
po/LINGUAS Normal file
View File

@@ -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

80
po/Makevars Normal file
View File

@@ -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

View File

@@ -5,8 +5,8 @@ src/process-monitor.c
src/process-statusbar.c src/process-statusbar.c
src/process-tree-view.c src/process-tree-view.c
src/process-window.c src/process-window.c
[type: gettext/glade]src/process-window.ui src/process-window.ui
src/settings.c src/settings.c
src/settings-dialog.c src/settings-dialog.c
[type: gettext/glade]src/settings-dialog.ui src/settings-dialog.ui
src/task-manager.c src/task-manager.c

View File

@@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
_Name=Task Manager Name=Task Manager
_Comment=Easy to use application to monitor system resources Comment=Easy to use application to monitor system resources
_GenericName=Task Manager GenericName=Task Manager
Exec=xfce4-taskmanager Exec=xfce4-taskmanager
Icon=org.xfce.taskmanager Icon=org.xfce.taskmanager
Terminal=false Terminal=false