Skip to content

Commit

Permalink
build: stop relying on intltool for i18n
Browse files Browse the repository at this point in the history
Recent gettext version can extract and merge back strings from and to
various file formats, no need for intltool anymore.

https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration
  • Loading branch information
dkosovic committed Feb 21, 2021
1 parent 12a186f commit 219123d
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 46 deletions.
84 changes: 69 additions & 15 deletions .gitignore
Expand Up @@ -4,40 +4,94 @@
*.la
Makefile
Makefile.in*
configure
compile
config.*
aclocal.m4
depcomp
install-sh
INSTALL
libtool
ltmain.sh
missing
mkinstalldirs
POTFILES
cscope.*out
*.pot
.dirstamp
stamp-*
.deps
.libs
autom4te.cache
intltool-*
po/*.gmo
po/.intltool-merge-cache
properties/resources.[ch]

/NetworkManager-l2tp*.tar*

/ABOUT-NLS
/INSTALL
/aclocal.m4
/autom4te.cache
/config.*
/configure

auth-dialog/nm-l2tp-auth-dialog
appdata/network-manager-l2tp.metainfo.xml

m4/codeset.m4
m4/extern-inline.m4
m4/fcntl-o.m4
m4/gettext.m4
m4/gtk-doc.m4
m4/intltool.m4
m4/glibc2.m4
m4/glibc21.m4
m4/iconv.m4
m4/intdiv0.m4
m4/intl.m4
m4/intldir.m4
m4/intlmacosx.m4
m4/intmax.m4
m4/inttypes-pri.m4
m4/inttypes_h.m4
m4/lcmessage.m4
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
m4/libtool.m4
m4/lock.m4
m4/longlong.m4
m4/lt*.m4
appdata/network-manager-l2tp.metainfo.xml
/cscope.*
m4/nls.m4
m4/pkg.m4
m4/po.m4
m4/printf-posix.m4
m4/progtest.m4
m4/size_max.m4
m4/stdint_h.m4
m4/threadlib.m4
m4/uintmax_t.m4
m4/visibility.m4
m4/wchar_t.m4
m4/wint_t.m4
m4/xsize.m4

auth-dialog/nm-l2tp-auth-dialog
nm-l2tp-service.name
nm-l2tp.desktop

po/*.gmo
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

properties/resources.[ch]

src/nm-l2tp-pppd-service-dbus.c
src/nm-l2tp-pppd-service-dbus.h
src/nm-l2tp-service

/NetworkManager-l2tp*.tar*
# The following names are no longer present on this branch,
# but they were on older versions. Thus keep ignoring them
# otherwise when switching branches these untracked files show
# up.
intltool-*
m4/intltool.m4
nm-l2tp.desktop
po/.intltool-merge-cache
16 changes: 5 additions & 11 deletions Makefile.am
Expand Up @@ -304,12 +304,14 @@ uninstall-hook:
endif

appdatadir = $(datadir)/metainfo
appdata_in_files = appdata/network-manager-l2tp.metainfo.xml.in
appdata_files = $(appdata_in_files:.xml.in=.xml)
if WITH_GNOME
appdata_DATA = $(appdata_files)

$(appdata_DATA): $(appdata_in_files)
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
endif
appdata_in_files = appdata/network-manager-l2tp.metainfo.xml.in
@INTLTOOL_XML_RULE@

nm-l2tp-service.name: $(srcdir)/nm-l2tp-service.name.in
$(AM_V_GEN) sed -e 's|[@]LIBEXECDIR[@]|$(libexecdir)|g' \
Expand All @@ -320,18 +322,10 @@ EXTRA_DIST += \
nm-l2tp-service.name.in \
$(dbusservice_DATA) \
$(appdata_in_files) \
$(appdata_files) \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
$(appdata_files)

CLEANFILES += \
$(nmvpnservice_DATA) \
$(appdata_files)

DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update

ACLOCAL_AMFLAGS = -I m4
14 changes: 7 additions & 7 deletions appdata/network-manager-l2tp.metainfo.xml.in
Expand Up @@ -6,8 +6,8 @@
<metadata_license>CC0-1.0</metadata_license>
<extends>nm-connection-editor.desktop</extends>
<extends>gnome-control-center.desktop</extends>
<_name>L2TP VPN Client</_name>
<_summary>Client for L2TP based virtual private networks</_summary>
<name>L2TP VPN Client</name>
<summary>Client for L2TP based virtual private networks</summary>

<keywords>
<keyword>network</keyword>
Expand All @@ -19,8 +19,8 @@
</keywords>

<description>
<_p>Support for configuring L2TP based virtual private network connections.</_p>
<_p>Compatible with L2TP and L2TP over IPsec services.</_p>
<p>Support for configuring L2TP based virtual private network connections.</p>
<p>Compatible with L2TP and L2TP over IPsec services.</p>
</description>

<screenshots>
Expand All @@ -29,12 +29,12 @@
</screenshot>

<screenshot type="default">
<_caption>The IPsec options dialog</_caption>
<caption>The IPsec options dialog</caption>
<image width="800" height="677">https://raw.githubusercontent.com/nm-l2tp/NetworkManager-l2tp/1.8.0/appdata/l2tp-ipsec.png</image>
</screenshot>

<screenshot type="default">
<_caption>The PPP options dialog</_caption>
<caption>The PPP options dialog</caption>
<image width="800" height="735">https://raw.githubusercontent.com/nm-l2tp/NetworkManager-l2tp/1.8.0/appdata/l2tp-ppp.png</image>
</screenshot>
</screenshots>
Expand All @@ -43,5 +43,5 @@
<url type="bugtracker">https://github.com/nm-l2tp/NetworkManager-l2tp/issues</url>
<update_contact>doug@uq.edu.au</update_contact>
<translation type="gettext">NetworkManager-l2tp</translation>
<_developer_name>The NetworkManager-L2TP Developers</_developer_name>
<developer_name>The NetworkManager-L2TP Developers</developer_name>
</component>
28 changes: 19 additions & 9 deletions autogen.sh
@@ -1,22 +1,32 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.

set -e

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
if test -z "$srcdir"; then
srcdir=.
fi

olddir=`pwd`

REQUIRED_AUTOMAKE_VERSION=1.9
PKG_NAME=NetworkManager-l2tp

(test -f $srcdir/configure.ac \
&& test -f $srcdir/auth-dialog/main.c) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
printf "**Error**: Directory "\`$srcdir\'" does not look like the" >&2
echo " top-level $PKG_NAME directory" >&2
exit 1
}

(cd $srcdir;
autoreconf --install --symlink &&
intltoolize --force &&
autoreconf &&
./configure --enable-maintainer-mode $@
)
cd $srcdir

aclocal --install || exit 1
autoreconf --verbose --force --install || exit 1

cd $olddir
if test -z "$NOCONFIGURE"; then
exec $srcdir/configure --enable-maintainer-mode --enable-more-warnings=error "$@"
fi

9 changes: 6 additions & 3 deletions configure.ac
Expand Up @@ -172,13 +172,16 @@ AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)

AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name files. Useful for development. (default is no)]))

dnl
dnl translation support
dnl
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])

GETTEXT_PACKAGE=NetworkManager-l2tp
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])

IT_PROG_INTLTOOL([0.35])
AM_GLIB_GNU_GETTEXT

# gio-unix will require glib and gio
PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32)
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
Expand Down
78 changes: 78 additions & 0 deletions 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

# 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 NetworkManager Authors.

# 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 = https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues

# 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 = yes

# 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
2 changes: 1 addition & 1 deletion po/POTFILES.in
Expand Up @@ -5,6 +5,7 @@ auth-dialog/main.c
properties/auth-helpers.c
properties/import-export.c
properties/ipsec-dialog.c
properties/nm-l2tp-dialog.ui
properties/nm-l2tp-editor.c
properties/nm-l2tp-editor-plugin.c
properties/ppp-dialog.c
Expand All @@ -13,4 +14,3 @@ shared/nm-l2tp-crypto-openssl.c
shared/nm-utils/nm-shared-utils.c
shared/nm-utils/nm-vpn-plugin-utils.c
src/nm-l2tp-service.c
[type: gettext/glade]properties/nm-l2tp-dialog.ui

0 comments on commit 219123d

Please sign in to comment.