summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIñigo Martínez <inigomartinez@gmail.com>2018-08-16 12:45:01 +0200
committerRay Strode <rstrode@redhat.com>2018-09-06 16:20:09 -0400
commitab9933da454bd4b0baf2e34cb2f1b8ef85669c55 (patch)
tree6b31a33562945515720e9c7214a6050d536b04ff
parent8a96984ff799ba1200d7f2c9f8139be0f33bf29c (diff)
downloadaccountsservice-ab9933da454bd4b0baf2e34cb2f1b8ef85669c55.tar.gz
build: Migrate from Intltool to Gettext
Recent versions of Gettext are able to translate several formats that are used in GNOME applications. This patch migrates from Intltool to Gettext by using meson's i18n features. Recent Gettext versions when used along with autotools, also make use of `PACKAGE` and `VERSION` variables[0]. Due to this the domain has been changed to use the value from `PACKAGE`. [0] https://www.gnu.org/software/autoconf/manual/gettext.html#configure_002eac
-rwxr-xr-xautogen.sh1
-rw-r--r--configure.ac19
-rw-r--r--data/Makefile.am3
-rw-r--r--data/org.freedesktop.accounts.policy.in16
-rw-r--r--po/Makevars34
-rw-r--r--po/Makevars.template41
-rw-r--r--po/POTFILES.in1
-rw-r--r--po/Rules-quot47
-rw-r--r--src/main.c4
9 files changed, 56 insertions, 110 deletions
diff --git a/autogen.sh b/autogen.sh
index 9c30f6b..43724c6 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -17,7 +17,6 @@ export ACLOCAL
(cd $(dirname $0);
autoreconf --install --force --symlink --verbose &&
- intltoolize --force &&
autoreconf --force --verbose)
test -n "$NOCONFIGURE" || "$(dirname $0)/configure" "$@"
diff --git a/configure.ac b/configure.ac
index 06cb5d7..6699b63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,6 @@
AC_INIT([AccountsService],[0.6.50])
AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz tar-ustar foreign])
-GETTEXT_PACKAGE=accounts-service
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
- [the gettext translation domain])
-
# Support silent build rules, requires at least automake-1.11. Enable
# by either passing --enable-silent-rules to configure or passing V=0
# to make
@@ -14,8 +9,18 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
PKG_PROG_PKG_CONFIG
-AM_GLIB_GNU_GETTEXT
-IT_PROG_INTLTOOL([0.40.0])
+
+# i18n
+AX_REQUIRE_DEFINED([AM_GNU_GETTEXT_VERSION])
+AM_GNU_GETTEXT_VERSION([0.19.8])
+
+AX_REQUIRE_DEFINED([AM_GNU_GETTEXT])
+AM_GNU_GETTEXT([external])
+
+GETTEXT_PACKAGE=accountsservice
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
+ [the gettext translation domain])
LT_INIT
LT_CURRENT=0
diff --git a/data/Makefile.am b/data/Makefile.am
index 521c6c2..b8cc528 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -18,7 +18,8 @@ policydir = $(datadir)/polkit-1/actions
policy_in_files = org.freedesktop.accounts.policy.in
policy_DATA = $(policy_in_files:.policy.in=.policy)
-@INTLTOOL_POLICY_RULE@
+org.freedesktop.accounts.policy: org.freedesktop.accounts.policy.in
+ $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
diff --git a/data/org.freedesktop.accounts.policy.in b/data/org.freedesktop.accounts.policy.in
index d149399..0169ae8 100644
--- a/data/org.freedesktop.accounts.policy.in
+++ b/data/org.freedesktop.accounts.policy.in
@@ -8,8 +8,8 @@
<icon_name>stock_person</icon_name>
<action id="org.freedesktop.accounts.change-own-user-data">
- <_description>Change your own user data</_description>
- <_message>Authentication is required to change your own user data</_message>
+ <description>Change your own user data</description>
+ <message>Authentication is required to change your own user data</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
@@ -18,8 +18,8 @@
</action>
<action id="org.freedesktop.accounts.change-own-password">
- <_description>Change your own user password</_description>
- <_message>Authentication is required to change your own user password</_message>
+ <description>Change your own user password</description>
+ <message>Authentication is required to change your own user password</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
@@ -28,8 +28,8 @@
</action>
<action id="org.freedesktop.accounts.user-administration">
- <_description>Manage user accounts</_description>
- <_message>Authentication is required to change user data</_message>
+ <description>Manage user accounts</description>
+ <message>Authentication is required to change user data</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
@@ -38,8 +38,8 @@
</action>
<action id="org.freedesktop.accounts.set-login-option">
- <_description>Change the login screen configuration</_description>
- <_message>Authentication is required to change the login screen configuration</_message>
+ <description>Change the login screen configuration</description>
+ <message>Authentication is required to change the login screen configuration</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
diff --git a/po/Makevars b/po/Makevars
index c2bda05..38dea9a 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -1,14 +1,14 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
-DOMAIN = $(GETTEXT_PACKAGE)
+DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2
+XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2
# 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
@@ -39,3 +39,33 @@ 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 = 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
diff --git a/po/Makevars.template b/po/Makevars.template
deleted file mode 100644
index 32692ab..0000000
--- a/po/Makevars.template
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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 = --keyword=_ --keyword=N_
-
-# 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 = Free Software Foundation, Inc.
-
-# 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 =
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 64ebc79..419419c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,4 @@
# List of source files which contain translatable strings.
-[encoding: UTF-8]
data/accounts-daemon.service.in
data/org.freedesktop.accounts.policy.in
src/main.c
diff --git a/po/Rules-quot b/po/Rules-quot
deleted file mode 100644
index 9c2a995..0000000
--- a/po/Rules-quot
+++ /dev/null
@@ -1,47 +0,0 @@
-# Special Makefile rules for English message catalogs with quotation marks.
-
-DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
-
-.SUFFIXES: .insert-header .po-update-en
-
-en@quot.po-create:
- $(MAKE) en@quot.po-update
-en@boldquot.po-create:
- $(MAKE) en@boldquot.po-update
-
-en@quot.po-update: en@quot.po-update-en
-en@boldquot.po-update: en@boldquot.po-update-en
-
-.insert-header.po-update-en:
- @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
- if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
- tmpdir=`pwd`; \
- echo "$$lang:"; \
- ll=`echo $$lang | sed -e 's/@.*//'`; \
- LC_ALL=C; export LC_ALL; \
- cd $(srcdir); \
- if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
- if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
- rm -f $$tmpdir/$$lang.new.po; \
- else \
- if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
- :; \
- else \
- echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
- exit 1; \
- fi; \
- fi; \
- else \
- echo "creation of $$lang.po failed!" 1>&2; \
- rm -f $$tmpdir/$$lang.new.po; \
- fi
-
-en@quot.insert-header: insert-header.sin
- sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
-
-en@boldquot.insert-header: insert-header.sin
- sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
-
-mostlyclean: mostlyclean-quot
-mostlyclean-quot:
- rm -f *.insert-header
diff --git a/src/main.c b/src/main.c
index 9caec7f..efdfe08 100644
--- a/src/main.c
+++ b/src/main.c
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
};
setlocale (LC_ALL, "");
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
#if !GLIB_CHECK_VERSION (2, 35, 3)
g_type_init ();
@@ -167,7 +167,7 @@ main (int argc, char *argv[])
}
context = g_option_context_new ("");
- g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+ g_option_context_set_translation_domain (context, PACKAGE);
g_option_context_set_summary (context, _("Provides D-Bus interfaces for querying and manipulating\nuser account information."));
g_option_context_add_main_entries (context, entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) {