After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755466 - Support for gettext without intltool
Support for gettext without intltool
Status: RESOLVED FIXED
Product: damned-lies
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: damned-lies Maintainer(s)
damned-lies Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-09-23 14:14 UTC by Piotr Drąg
Modified: 2016-09-07 14:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Piotr Drąg 2015-09-23 14:14:37 UTC
More and more modules are migrating from intltool to just using gettext (gtk+, zenity, gnome-flashback and friends, giggle...). Damned-lies tries to run intltool-update on them, which doesn't extract important .ui files. intltool upstream is inactive: <https://bugs.launchpad.net/intltool/+bug/1325597>. Maybe we could adapt <https://git.gnome.org/browse/gtk+/tree/make-pot> for these modules on damned-lies?
Comment 1 Claude Paroz 2015-09-24 08:02:38 UTC
Could you investigate a bit and collect some more information? In particular:
- Is it possible to automatically find out if a module is using intltool or plain gettext?
- When using plain gettext, what are the commands needed to produce a .pot file and for merging translations?
- Are POTFILES.in/POTFILES.skip still playing a role in the new process?
Comment 2 Piotr Drąg 2015-09-24 17:25:48 UTC
So here is an example commit: <https://git.gnome.org/browse/zenity/commit/?id=dc9719729899574d7f3b2056382af83fd106bd47>. I think it still uses POTFILES.in to generate POTFILES.

I guess you can check if configure.ac contains IT_PROG_INTLTOOL.

To make a .pot file, you need to run autogen.sh and then do "cd po && make zenity.pot". "cd po && make update-po" will update the .po files.

The GTK+'s script allows to update .po files without the messy autogen. I changed GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gtk30}" to GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-zenity}" and tested it on zenity. It works fine.
Comment 3 Claude Paroz 2015-09-24 17:44:36 UTC
> To make a .pot file, you need to run autogen.sh and then do "cd po && make zenity.pot". "cd po && make update-po" will update the .po files.

I always refused to go the "autogen.sh" route. If packages cannot build pot files from their plain sources, they are simply not supported by DL any more.

Maybe we should open bug reports against those packages so as their maintainers can suggest a proper way of generating pots.
Comment 4 Piotr Drąg 2015-09-24 17:50:06 UTC
Sure, we can go module-by-module and add a modified make-po script (or some other way to generate a .pot file in a clean manner), but IMHO it would be much more efficient to have it server-side.

The list of gettext-only modules will only grow, as maintainers are getting tired of intltool. So we can continue to enforce a broken, unmaintained tool, or embrace the change.
Comment 5 Claude Paroz 2015-09-24 17:58:13 UTC
I'm all for embracing the change. I only regret that module maintainers decide to change the toolchain without even wondering about consequences (that's the outside impression, at least).

Now if we can get a list of commands to run server side for those modules, that's fine. Someone has to figure it out, though. And hopefully this will not be another set of commands for each module!

But for me, running autogen.sh is not acceptable. Then, DL is not mine, and if anyone wants to take maintainership and try another strategy, that would be fine, really.
Comment 6 Piotr Drąg 2015-09-24 18:15:21 UTC
I agree that some maintainers have been irresponsible, but I'll leave it for now.

Yes, running autogen.sh would be horrible. Thankfully, <https://git.gnome.org/browse/gtk+/tree/make-pot> allows us to make a .pot file without autogen.sh. GTK+ uses it now with "[ -e ../make-pot ] && (cd .. && ./make-pot) || intltool-update -g gtk+ -p" set on damned-lies.

What I'm asking is having this script on the d-l server and running it on modules that don't use intltool anymore, instead of copy-pasting it to every git repository.
Comment 7 Claude Paroz 2015-09-24 18:43:41 UTC
That GTK make-pot script is a good starting point, indeed. I guess now the question is about xgettext flags to use, notably the --flag options. Are they all valid for all modules, or should they differ per-module?

Are we dropping the intltool capability of finding missing files in POTFILES.in?
Comment 8 Piotr Drąg 2015-09-24 18:57:43 UTC
(In reply to Claude Paroz from comment #7)
> That GTK make-pot script is a good starting point, indeed. I guess now the
> question is about xgettext flags to use, notably the --flag options. Are
> they all valid for all modules, or should they differ per-module?

I don't know. So far they seem to differ:

https://git.gnome.org/browse/zenity/tree/po/Makevars#n10

https://git.gnome.org/browse/giggle/tree/po/Makevars#n10

https://git.gnome.org/browse/gnome-flashback/tree/po/Makevars#n10

GTK+ itself seems to be the most elaborate.

> Are we dropping the intltool capability of finding missing files in
> POTFILES.in?

Unfortunately, xgettext can't do that. :(
Comment 9 Claude Paroz 2015-10-01 19:53:48 UTC
https://git.gnome.org/browse/damned-lies/commit/?id=47600623ff396a3a6b78b33e81b4f3b9d294f5dc adds support for pure xgettext extraction.

I tried to automatically detect intltool usage, but I couldn't find a trustworthy method. Therefore, such modules should set '<gettext>' in their pot_method field.

Then I also had to add the ability to set different po domains per branch. (branch_from and branch_to fields for domains).

We'll have to convert some other modules than zenity (my test module) and we'll see how it goes...
Comment 10 Claude Paroz 2015-10-01 20:06:58 UTC
Also note that with xgettext, the source paths in po files are now relative to the root path, not to the /po. I didn't find a way to keep the "relative-to-po-directory" paths.
Comment 11 Piotr Drąg 2015-10-01 20:22:21 UTC
This is amazing! Thank you so much for your work.

I tried to set up another module, but I can't find the pot_method field in the admin interface.
Comment 12 Claude Paroz 2015-10-01 20:24:37 UTC
On the module page, down to the Domains section, under "Advanced" section which is hidden by default.
Comment 13 Piotr Drąg 2015-10-01 20:58:44 UTC
Oh, I see it now.

I converted gnome-flashback and there are two problems:

https://l10n.gnome.org/module/gnome-flashback/ - languages are duplicated

https://l10n.gnome.org/POT/gnome-flashback.master/gnome-flashback.master.pl.po - strings with context (msgctxt) are not extracted, for example this one:

#: gnome-flashback/libsound-applet/gvc-channel-bar.c:540
msgctxt "volume"
msgid "Unamplified"
msgstr "Bez wzmocnienia"

Could it be because https://git.gnome.org/browse/gnome-flashback/tree/po/Makevars#n53 is set to "no"?
Comment 14 Claude Paroz 2015-10-02 07:34:58 UTC
The missing context is due to a missing XGETTEXT_OPTIONS in Makevars: --keyword=C_:1c,2

For the duplicate language issue, I'll investigate.
Comment 15 Claude Paroz 2015-10-02 07:52:46 UTC
The duplicate language issue should be now fixed.
Comment 16 Alberts Muktupāvels 2016-02-12 00:42:03 UTC
gettext 0.19.7 has new functionality:
"xgettext can now load custom string extraction rules supplied by consumer projects. The rules are written in XML, utilizing the Internationalization Tag Set (ITS) standard. All the existing XML-based language scanners (Glade, GSettings, and AppData) are rewritten using ITS. In addition, msgfmt now has --xml option to merge translations back to the original XML document."

its files are already provided by at least two modules:
https://git.gnome.org/browse/glib/commit/?id=50645b724a3b43767fd57e4af53365d0cd270382
https://git.gnome.org/browse/gtk+/commit/?id=f9e6ccd59256ef86bdfa3bfe9810df35f7ee00fe

I want port metacity to upstream gettext and to do that I will need to use ITS files to translate few .xml files. In my case ITS files probably will be provided from other module...

xgettext reads its files from GETTEXTDATADIR/its (/usr/share/gettext/its).

Will Damned-lies be able to handle this?
Comment 17 Claude Paroz 2016-02-12 07:06:45 UTC
Thanks Alberts for sharing this interesting news. I would suggest to open two new bug reports: one for upgrading gettext from 0.19.6 to 0.19.7 on the Damned-Lies servers (against sysadmin product), and a second one (depending on the former) to adapt Damned-Lies to this new functionality.
Comment 18 Claude Paroz 2016-02-13 13:21:21 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=761992 for the gettext upgrade.
Comment 19 Alberts Muktupāvels 2016-09-06 21:08:50 UTC
Now gettext is upgraded, any news for supporting its files?
Comment 20 Claude Paroz 2016-09-07 09:48:44 UTC
That should work now, can you check?
Comment 21 Alberts Muktupāvels 2016-09-07 11:48:59 UTC
I think it works - now mutter includes also xml translations that was missing before I added previous comment.
Comment 22 Claude Paroz 2016-09-07 14:11:02 UTC
The commit adding ITS support is https://git.gnome.org/browse/damned-lies/commit/?id=bf56f5c84690cd336bcb4f5321d0e82f841ac73a