GNOME Bugzilla – Bug 787296
[Patch] Migrate from intltool to gettext
Last modified: 2020-11-12 14:28:23 UTC
Created attachment 359163 [details] [review] [Patch] Migrate from intltool to gettext Intltool is deprecated and should no longer be used. There is also [1] to encourage dropping it in GNOME tooling, in favor of GNU gettext. Attached is an *initial* patch to perform the migration. Unsolved problems which still remain: * Translating PolKit policy files works on my system, but from what I understand we need to check whether the correct ITS files are installed. * Currently, gettext fails on the Japanese po-file with the following message: > ja.po:1689: format specifications in 'msgid_plural' and 'msgstr[0]' for argument 1 are not the same > ja.po:10111: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same > ja.po:10156: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same * I don't know what LTS distro's NetworkManager officially supports, but there's a chance some of them won't have a new enough gettext version (i.e. >= 0.19.8). [1] https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration
Review of attachment 359163 [details] [review]: Adding several comments as I recently did the same work for ModemManager and they really are equivalent, see the MM patch: https://lists.freedesktop.org/archives/modemmanager-devel/2017-September/005712.html ::: Makefile.am @@ +153,3 @@ +$(polkit_policy_DATA): $(dist_polkit_policy_in_in_files) + $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ Isn't this wrong? There should be no direct polkit.in.in->polkit transition. There are 2 choices here: 1) configure generates the polkit.in file from the polkit.in.in (as it's in AC_CONFIG_FILES) and then msgfmt adds translations in the .polkit file generated from the polkit.in file. This requires the user building from a dist tarball to have the msgfmt program installed. 2) msfgmt generates polkit.in from polkit.in.in including the translations, and the generated polkit.in is included in dist. Then, an additional sed rule generates the polkit file from the polkit.in file include the requested NM_MODIFY_SYSTEM_POLICY. In ModemManager we decided to use the second approach. ::: autogen.sh @@ +25,3 @@ gtkdocize autopoint --force +autoreconf --force --install --verbose If the AUTOPOINT envvar is no longer overwritten, autoreconf will call autopoint, so there is no need to first call autopoint explicitly and then autoreconf, just autoreconf should be enough, ::: po/Makevars @@ +19,3 @@ +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. The FSF has nothing to do here :) Something like "NetworkManager developers" would be more appropriate. @@ +39,3 @@ +# 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 = In ModemManager I needed to set this as well explicitly, otherwise a "make dist" or "make distcheck" would end up regenerating the PO files: DIST_DEPENDS_ON_UPDATE_PO = no
Review of attachment 359163 [details] [review]: Oh, one additional note, I believe the polkit ITS files should be distributed by NM and "GETTEXTDATADIR" set accordingly in the msgfmt call, at least until we can build-depend on a polkit release that distributes them.
> * I don't know what LTS distro's NetworkManager officially supports, but > there's a chance some of them won't have a new enough gettext version (i.e. >= > 0.19.8). Our CI still runs (by default) on RHEL-7.3. That doesn't have a recent enough gettext, however gettext-0.19.8 is in RHEL-7.4. I think it's too early to merge this patch, preferably you can build NM also on a rather old distro. But thanks for reaching out early with an initial patch!! I have no useful comments otherwise, patch looks good to me, Aleksander's suggestions make sense to me. I wish we could get rid of recursive make for po. But that is for another day.
See also bug 788147
(In reply to Niels De Graef from comment #0) > * Currently, gettext fails on the Japanese po-file with the following > message: > > ja.po:1689: format specifications in 'msgid_plural' and 'msgstr[0]' for argument 1 are not the same > > ja.po:10111: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same > > ja.po:10156: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same > It’s been fixed in https://bugzilla.gnome.org/show_bug.cgi?id=787382.
Created attachment 367792 [details] [review] build/meson: Migrate from Intltool to Gettext Recently NetworkManager has included meson as build system. This patch modifies meson build files to also migrate from intltool to gettext. This patch should be applied along with the existing patch (attachment 359163 [details] [review]). However, I've made a self-working patch so it also modifies `POTFILES.in` file, so please merge these changes with the existing patch if it's necessary.
Created attachment 367793 [details] [review] build/meson: Migrate from Intltool to Gettext I forgot to also include the changes in the policy file template. Here goes an update. Probably this file will also collide with some changes in the original patch (attachment 359163 [details] [review]).
bugzilla.gnome.org is being shut down in favor of a GitLab instance. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).