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 787588 - Migrate from Intltool to Gettext (meson)
Migrate from Intltool to Gettext (meson)
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on: 785414
Blocks:
 
 
Reported: 2017-09-12 15:00 UTC by Iñigo Martínez
Modified: 2018-01-24 19:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Migrate from Intltool to Gettext (77.35 KB, patch)
2017-09-12 15:03 UTC, Iñigo Martínez
none Details | Review
sharing: add XML declaration to the .policy file (1.01 KB, patch)
2017-09-12 15:43 UTC, Piotr Drąg
committed Details | Review
sound: specify encoding in the XML declaration of gnome-sounds-default.xml (984 bytes, patch)
2017-09-12 15:44 UTC, Piotr Drąg
committed Details | Review
build: Migrate from Intltool to Gettext (71.11 KB, patch)
2018-01-18 19:02 UTC, Iñigo Martínez
none Details | Review
build: Move timezone languages to LINGUAS file (2.30 KB, patch)
2018-01-18 19:38 UTC, Iñigo Martínez
committed Details | Review
build: Migrate from Intltool to Gettext (72.16 KB, patch)
2018-01-19 19:19 UTC, Iñigo Martínez
committed Details | Review
build: Fix translation context missing from keyboard entries (1.26 KB, patch)
2018-01-23 16:42 UTC, Bastien Nocera
none Details | Review
build: Fix translation context missing from keyboard entries (1.54 KB, patch)
2018-01-23 19:43 UTC, Iñigo Martínez
committed Details | Review

Description Iñigo Martínez 2017-09-12 15:00:37 UTC
This patch migrates `gnome-control-center`'s meson port from intltool to gettext. This patch also includes ITS rules for the `gnome-sounds-default.xml` file.

Although all strings are translated, `gettext` surprisingly uses an alternative character representation (&#xXXXX;) for files `gnome-sounds-default.xml` and the `org.gnome.controlcenter.remote-login-helper.policy`.

I have checked it and they are working correctly.
Comment 1 Iñigo Martínez 2017-09-12 15:03:02 UTC
Created attachment 359641 [details] [review]
Migrate from Intltool to Gettext

The code has also been uploaded in the meson's wip branch: https://git.gnome.org/browse/gnome-control-center/log/?h=wip/inigomartinez/meson
Comment 2 Piotr Drąg 2017-09-12 15:43:53 UTC
Created attachment 359644 [details] [review]
sharing: add XML declaration to the .policy file
Comment 3 Piotr Drąg 2017-09-12 15:44:08 UTC
Created attachment 359645 [details] [review]
sound: specify encoding in the XML declaration of gnome-sounds-default.xml
Comment 4 Piotr Drąg 2017-09-12 15:44:36 UTC
(In reply to Iñigo Martínez from comment #0)
> Although all strings are translated, `gettext` surprisingly uses an
> alternative character representation (&#xXXXX;) for files
> `gnome-sounds-default.xml` and the
> `org.gnome.controlcenter.remote-login-helper.policy`.
> 

Could you check if these patches help with that?
Comment 5 Iñigo Martínez 2017-09-12 15:57:06 UTC
I've just checked it and it's solved now. They are using the same character representation used by the other translated files.

Thank you!
Comment 6 Iñigo Martínez 2018-01-18 19:02:10 UTC
Created attachment 367033 [details] [review]
build: Migrate from Intltool to Gettext

Here goes an update to the `Migrate from intltool to gettext` patch after the recent merge of the meson build port.
Comment 7 Iñigo Martínez 2018-01-18 19:38:38 UTC
Created attachment 367035 [details] [review]
build: Move timezone languages to LINGUAS file

The timezone panel uses translations for the existing timezone names. This was using a set of predefined languages inside the meson's build file.

This set of languages has been moved to the LINGUAS file, (which can also help damned-lies).
Comment 8 Bastien Nocera 2018-01-19 11:02:42 UTC
Review of attachment 359644 [details] [review]:

Is there a bug filed against gettext to default to UTF-8? If so, please reference it in the commit message with "See http..."
Comment 9 Bastien Nocera 2018-01-19 11:03:11 UTC
Review of attachment 359645 [details] [review]:

Same as previous patch.
Comment 10 Bastien Nocera 2018-01-19 11:07:09 UTC
Review of attachment 367033 [details] [review]:

Looks fine otherwise.

::: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
@@ +14,1 @@
 X-GNOME-Bugzilla-Component=properties

I don't think it needs to be removed, and if it did, it should be in a separate patch.

::: panels/color/gnome-color-panel.desktop.in.in
@@ +14,1 @@
 X-GNOME-Bugzilla-Component=color

And here as well, and probably in a number of other places.

::: panels/keyboard/50-accessibility.xml.in
@@ +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<KeyListEntries group="system" name="Universal Access" schema="org.gnome.settings-daemon.plugins.media-keys">

Is a rule, its or loc necessary for those types of files?
Comment 11 Bastien Nocera 2018-01-19 11:08:54 UTC
Review of attachment 367035 [details] [review]:

Sure, pending the previous patch getting merged.
Comment 12 Iñigo Martínez 2018-01-19 11:20:48 UTC
(In reply to Bastien Nocera from comment #10)
> ::: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
> @@ +14,1 @@
>  X-GNOME-Bugzilla-Component=properties
> 
> I don't think it needs to be removed, and if it did, it should be in a
> separate patch.
> 
> ::: panels/color/gnome-color-panel.desktop.in.in
> @@ +14,1 @@
>  X-GNOME-Bugzilla-Component=color
> 
> And here as well, and probably in a number of other places.

There must be some confusion here. The `X-GNOME-Bugzilla-Component` entries are still in place in the desktop files here. I have also checked the patch and it doesn't touch them.

> ::: panels/keyboard/50-accessibility.xml.in
> @@ +1,2 @@
>  <?xml version="1.0" encoding="UTF-8"?>
> +<KeyListEntries group="system" name="Universal Access"
> schema="org.gnome.settings-daemon.plugins.media-keys">
> 
> Is a rule, its or loc necessary for those types of files?

I don't what should be the proper behaviour here. The build commands from autotools (just before the meson port merge) used `INTLTOOL_XML_NOMERGE_RULE` rule, that applies the following command:

LC_ALL=C /usr/bin/intltool-merge -x -u --no-translations

The command doesn't translate those files. I don't know the reason behing this. However, there are some keyworkds in the file `description` and `name` that are supposed to be translated, even there are translated strings in the language `.po` files.

I wonder if the reason for not translating them was that the `its` and `loc` files was present.

If you think that this should also be translated I can create proper rules to be  applied.

[0] https://git.gnome.org/browse/gnome-control-center/tree/panels/keyboard/Makefile.am?id=ca3779467e075c2b693adf4c6034e5b5e4b9bb6a#n48
Comment 13 Iñigo Martínez 2018-01-19 11:23:02 UTC
Sorry I made some mistakes.

> I don't _know_ what should be the proper behaviour here.

> I don't know the reason behind this.

> I wonder if the reason for not translating them was that the `its` and `loc` files were not present.
Comment 14 Bastien Nocera 2018-01-19 11:24:23 UTC
(In reply to Iñigo Martínez from comment #12)
> (In reply to Bastien Nocera from comment #10)
> > ::: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
> > @@ +14,1 @@
> >  X-GNOME-Bugzilla-Component=properties
> > 
> > I don't think it needs to be removed, and if it did, it should be in a
> > separate patch.
> > 
> > ::: panels/color/gnome-color-panel.desktop.in.in
> > @@ +14,1 @@
> >  X-GNOME-Bugzilla-Component=color
> > 
> > And here as well, and probably in a number of other places.
> 
> There must be some confusion here. The `X-GNOME-Bugzilla-Component` entries
> are still in place in the desktop files here. I have also checked the patch
> and it doesn't touch them.

I might have been confused by the review UI then, feel free to ignore.

> > ::: panels/keyboard/50-accessibility.xml.in
> > @@ +1,2 @@
> >  <?xml version="1.0" encoding="UTF-8"?>
> > +<KeyListEntries group="system" name="Universal Access"
> > schema="org.gnome.settings-daemon.plugins.media-keys">
> > 
> > Is a rule, its or loc necessary for those types of files?
> 
> I don't what should be the proper behaviour here. The build commands from
> autotools (just before the meson port merge) used
> `INTLTOOL_XML_NOMERGE_RULE` rule, that applies the following command:
> 
> LC_ALL=C /usr/bin/intltool-merge -x -u --no-translations
> 
> The command doesn't translate those files. I don't know the reason behing
> this. However, there are some keyworkds in the file `description` and `name`
> that are supposed to be translated, even there are translated strings in the
> language `.po` files.
> 
> I wonder if the reason for not translating them was that the `its` and `loc`
> files was present.
> 
> If you think that this should also be translated I can create proper rules
> to be  applied.

IIRC, the files themselves aren't translated, but the strings are marked for translation, and the translations added to the .mo/.gmo files, and translated in the code.

I'm guessing that wouldn't be the case anymore.

> [0]
> https://git.gnome.org/browse/gnome-control-center/tree/panels/keyboard/
> Makefile.am?id=ca3779467e075c2b693adf4c6034e5b5e4b9bb6a#n48
Comment 16 Piotr Drąg 2018-01-19 15:42:43 UTC
Comment on attachment 359644 [details] [review]
sharing: add XML declaration to the .policy file

There is now: https://savannah.gnu.org/bugs/?52932

Pushed in https://git.gnome.org/browse/gnome-control-center/commit/?id=3807e457555e7a894e0751a7987e61f71ed5c38a
Comment 17 Piotr Drąg 2018-01-19 15:42:55 UTC
Comment on attachment 359645 [details] [review]
sound: specify encoding in the XML declaration of gnome-sounds-default.xml

https://git.gnome.org/browse/gnome-control-center/commit/?id=9db20522d3402679ad17fe867b881a770d900c0c
Comment 18 Piotr Drąg 2018-01-19 16:24:24 UTC
(In reply to Piotr Drąg from comment #16)
> Comment on attachment 359644 [details] [review] [review]
> sharing: add XML declaration to the .policy file
> 
> There is now: https://savannah.gnu.org/bugs/?52932
> 

A gettext developer is asking questions I’m not qualified to answer.
Comment 19 Iñigo Martínez 2018-01-19 19:19:06 UTC
Created attachment 367103 [details] [review]
build: Migrate from Intltool to Gettext

(In reply to Piotr Drąg from comment #15)
> We have the .its/.loc files for these already, see
> https://bugzilla.gnome.org/show_bug.cgi?id=769066 and
> https://git.gnome.org/browse/gnome-control-center/commit/
> ?id=f7fad92c3ef00134e59f4cca5d38387e6784a0fc

Thanks! Those files were copied to the gettext directory under installation directory but I wasn't doing anything else with them.

I have moved them to the `${srcdir}/gettext/its` directory along `sounds.[its|loc]` files, which makes sense to me. The whole directory is also copied to the gettext directory under installation directory, so now `sounds.[its|loc]` files are also copied (which I think should have been done before but it's fixed now).

Bastien, could you please take a quick view at this? (it has some minor change only).

(In reply to Piotr Drąg from comment #18)
> 
> A gettext developer is asking questions I’m not qualified to answer.

Although I'm not an expert, I tried to find a proper answer for this and I have found the following[0]:

> 5.1.4 Input file interpretation
>
> ‘--from-code=name’
>
>     Specifies the encoding of the input files. This option is needed only if some untranslated message strings or their corresponding comments contain non-ASCII characters. Note that Tcl and Glade input files are always assumed to be in UTF-8, regardless of this option.
>
> By default the input files are assumed to be in ASCII. 

Taking this in consideration, the XML files are expected to be using ASCII unless the encoding is especified, and that was our issue when translating the files. I suppose that `intltool` should be assuming that the file was encoded using `UTF-8`.

[0] https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html
Comment 20 Iñigo Martínez 2018-01-22 11:40:20 UTC
(In reply to Piotr Drąg from comment #18)
> (In reply to Piotr Drąg from comment #16)
> > Comment on attachment 359644 [details] [review] [review] [review]
> > sharing: add XML declaration to the .policy file
> > 
> > There is now: https://savannah.gnu.org/bugs/?52932
> > 
> 
> A gettext developer is asking questions I’m not qualified to answer.

Following the thread (I have also answered this there) and one of its links, it says the following:

> In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), it is a fatal error for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8. Note that since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly need an encoding declaration.

As I said in that thread, the last sentence is the critical one for me. The fact that ASCII doesn't need the encoding declaration makes it the default in those cases. In our case, the encoding must be UTF-8, so actually the modifications in attachment 359644 [details] [review] and on attachment 359645 [details] [review] are necessary.

[0] https://www.w3.org/TR/xml/#charencoding
Comment 21 Bastien Nocera 2018-01-23 09:45:11 UTC
(In reply to Iñigo Martínez from comment #20)
> (In reply to Piotr Drąg from comment #18)
> > (In reply to Piotr Drąg from comment #16)
> > > Comment on attachment 359644 [details] [review] [review] [review] [review]
> > > sharing: add XML declaration to the .policy file
> > > 
> > > There is now: https://savannah.gnu.org/bugs/?52932
> > > 
> > 
> > A gettext developer is asking questions I’m not qualified to answer.
> 
> Following the thread (I have also answered this there) and one of its links,
> it says the following:
> 
> > In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), it is a fatal error for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8. Note that since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly need an encoding declaration.
> 
> As I said in that thread, the last sentence is the critical one for me. The
> fact that ASCII doesn't need the encoding declaration makes it the default
> in those cases.

No, it just says that ASCII is a subset of UTF-8. But UTF-8 is the default. I commented on the savannah bug.

Re-read the first sentence, the encoding is either, in order:
- provided by an external transport protocol (like the encoding header in HTTP)
- named in the declaration (as you did in the patch)
- provided through the presence of a BOM in the file
- or is implicitly UTF-8

And that last phrase "ASCII is a subset of UTF-8, so you don't need to declare that the source is ASCII because ASCII is already contained within the default UTF-8 encoding".

> In our case, the encoding must be UTF-8, so actually the
> modifications in attachment 359644 [details] [review] [review] and on attachment
> 359645 [details] [review] are necessary.

They wouldn't be if gettext followed the XML spec :)
Comment 22 Bastien Nocera 2018-01-23 10:01:01 UTC
Attachment 367035 [details] pushed as 811ba92 - build: Move timezone languages to LINGUAS file
Attachment 367103 [details] pushed as 0dd386f - build: Migrate from Intltool to Gettext
Comment 23 Piotr Drąg 2018-01-23 15:38:18 UTC
It seems that gnome-keybindings.its can’t handle https://git.gnome.org/browse/gnome-control-center/tree/panels/keyboard/01-launchers.xml.in#n16. It’s the only one with msgctxt.
Comment 24 Bastien Nocera 2018-01-23 15:52:47 UTC
(In reply to Piotr Drąg from comment #23)
> It seems that gnome-keybindings.its can’t handle
> https://git.gnome.org/browse/gnome-control-center/tree/panels/keyboard/01-
> launchers.xml.in#n16. It’s the only one with msgctxt.

Ha, my fault. I tested the Keyboard and Date & Time panels in a translated language and didn't catch that problem.
Comment 25 Bastien Nocera 2018-01-23 15:56:43 UTC
Would this fix it? Note that I didn't even compile test it.

diff --git a/gettext/its/gnome-keybindings.its b/gettext/its/gnome-keybindings.its
index 4d4b7c6ee..0d52827b4 100644
--- a/gettext/its/gnome-keybindings.its
+++ b/gettext/its/gnome-keybindings.its
@@ -4,6 +4,7 @@
   <its:translateRule selector="/KeyListEntries/@name" translate="yes"/>
   <its:translateRule selector="//KeyListEntry" translate="no"/>
   <its:translateRule selector="//KeyListEntry/@description" translate="yes"/>
+  <its:Context selector="//KeyListEntry/@msgctxt" translate="no"/>
 
   <!-- Extracted strings are consumed by the library and are never
        merged back; we don't want to escape special characters.  -->
Comment 27 Piotr Drąg 2018-01-23 16:28:07 UTC
I tried “meson .. && ninja gnome-control-center-2.0-pot” and I get this, with and without the patched gnome-keybindings.its:

#: panels/keyboard/01-launchers.xml.in:16
#: panels/search/gnome-search-panel.desktop.in.in:3 shell/window.ui:157
msgid "Search"
msgstr ""

I might be doing something wrong, though.
Comment 28 Bastien Nocera 2018-01-23 16:42:42 UTC
Created attachment 367322 [details] [review]
build: Fix translation context missing from keyboard entries

Extract the message context from 01-launchers.xml.in so it's available
for translation.
Comment 29 Piotr Drąg 2018-01-23 17:02:56 UTC
The only other Meson and gettext project in GNOME I could find is libgweather: https://gitlab.gnome.org/GNOME/libgweather/commit/a5d17340753eff516ea1a1e3304643c7b5a2c3fe (although it doesn’t have a .loc file, so something might be wrong there.)
Comment 30 Piotr Drąg 2018-01-23 17:06:21 UTC
(I meant “The only other Meson and gettext project in GNOME *with msgctxt in an .its file*”, of course.)
Comment 31 Iñigo Martínez 2018-01-23 19:43:14 UTC
Created attachment 367331 [details] [review]
build: Fix translation context missing from keyboard entries

I have updated Bastien's patch which missed a couple of things. It should also extract now the `msgctxt`.
Comment 32 Georges Basile Stavracas Neto 2018-01-23 19:46:49 UTC
I am not qualified to give a final word on it. It *looks* correct though. How do I test this patch? Piotr, Bastien, do you have any other concerns?
Comment 33 Bastien Nocera 2018-01-24 16:03:37 UTC
From within the jhbuild build directory I get:
$ ninja -v gnome-control-center-2.0-pot
[0/1] /usr/bin/python3 /usr/bin/meson --internal commandrunner /home/hadess/Projects/jhbuild/gnome-control-center /home/hadess/.cache/jhbuild/build/gnome-control-center po /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot --pkgname=gnome-control-center-2.0 --datadirs=/home/hadess/Projects/jhbuild/gnome-control-center/gettext --extra-args=--from-code=UTF-8@@--keyword=g_dngettext:2,3@@--flag=g_string_append_printf:2:c-format@@--keyword=g_dpgettext2:2c,3@@--flag=g_string_printf:2:c-format@@--add-comments@@--flag=g_strdup_printf:1:c-format@@--flag=g_set_error:4:c-format@@--keyword=g_dcgettext:2@@--flag=g_error_new:3:c-format@@--flag=NC_:2:pass-c-format@@--keyword=C_:1c,2@@--flag=g_dngettext:2:pass-c-format@@--flag=N_:1:pass-c-format@@--flag=C_:2:pass-c-format@@--keyword=NC_:1c,2@@--keyword=N_@@--keyword=_
xgettext: warning: file '	../panels/background/background.ui \' extension 'ui \' is unknown; will try C
xgettext: error while opening "	../panels/background/background.ui \" for reading: No such file or directory
FAILED: meson-gnome-control-center-2.0-pot 
/usr/bin/python3 /usr/bin/meson --internal commandrunner /home/hadess/Projects/jhbuild/gnome-control-center /home/hadess/.cache/jhbuild/build/gnome-control-center po /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot --pkgname=gnome-control-center-2.0 --datadirs=/home/hadess/Projects/jhbuild/gnome-control-center/gettext --extra-args=--from-code=UTF-8@@--keyword=g_dngettext:2,3@@--flag=g_string_append_printf:2:c-format@@--keyword=g_dpgettext2:2c,3@@--flag=g_string_printf:2:c-format@@--add-comments@@--flag=g_strdup_printf:1:c-format@@--flag=g_set_error:4:c-format@@--keyword=g_dcgettext:2@@--flag=g_error_new:3:c-format@@--flag=NC_:2:pass-c-format@@--keyword=C_:1c,2@@--flag=g_dngettext:2:pass-c-format@@--flag=N_:1:pass-c-format@@--flag=C_:2:pass-c-format@@--keyword=NC_:1c,2@@--keyword=N_@@--keyword=_
ninja: build stopped: subcommand failed.
Comment 34 Iñigo Martínez 2018-01-24 16:22:22 UTC
(In reply to Bastien Nocera from comment #33)
> From within the jhbuild build directory I get:
> $ ninja -v gnome-control-center-2.0-pot
> [0/1] /usr/bin/python3 /usr/bin/meson --internal commandrunner
> /home/hadess/Projects/jhbuild/gnome-control-center
> /home/hadess/.cache/jhbuild/build/gnome-control-center po /usr/bin/python3
> /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot
> --pkgname=gnome-control-center-2.0
> --datadirs=/home/hadess/Projects/jhbuild/gnome-control-center/gettext
> --extra-args=--from-code=UTF-8@@--keyword=g_dngettext:2,3@@--
> flag=g_string_append_printf:2:c-format@@--keyword=g_dpgettext2:2c,3@@--
> flag=g_string_printf:2:c-format@@--add-comments@@--flag=g_strdup_printf:1:c-
> format@@--flag=g_set_error:4:c-format@@--keyword=g_dcgettext:2@@--
> flag=g_error_new:3:c-format@@--flag=NC_:2:pass-c-format@@--keyword=C_:1c,2@@-
> -flag=g_dngettext:2:pass-c-format@@--flag=N_:1:pass-c-format@@--flag=C_:2:
> pass-c-format@@--keyword=NC_:1c,2@@--keyword=N_@@--keyword=_
> xgettext: warning: file '	../panels/background/background.ui \' extension
> 'ui \' is unknown; will try C
> xgettext: error while opening "	../panels/background/background.ui \" for
> reading: No such file or directory

That sounds a bit odd because:

1. The `*.ui` files should be covered by the gtkbuilder.loc[0] and gtkbuilder.its[1] its rules.
2. The background.ui file should be present[2].

I have also tried it in a jhbduild environment with the following output

$ ninja -v -C _build/ gnome-control-center-2.0-pot 
ninja: Entering directory `_build/'
[0/1] /usr/bin/python3 /usr/bin/meson --internal commandrunner /gnome/gnome-control-center /gnome/gnome-control-center/_build po /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot --pkgname=gnome-control-center-2.0 --datadirs=/gnome/gnome-control-center/gettext --extra-args=--keyword=g_dcgettext:2@@--keyword=g_dngettext:2,3@@--flag=g_set_error:4:c-format@@--flag=g_string_printf:2:c-format@@--keyword=g_dpgettext2:2c,3@@--add-comments@@--flag=NC_:2:pass-c-format@@--keyword=N_@@--from-code=UTF-8@@--keyword=_@@--keyword=C_:1c,2@@--flag=N_:1:pass-c-format@@--flag=C_:2:pass-c-format@@--flag=g_strdup_printf:1:c-format@@--flag=g_error_new:3:c-format@@--keyword=NC_:1c,2@@--flag=g_dngettext:2:pass-c-format@@--flag=g_string_append_printf:2:c-format

Could it be possible that something is not properly configured in your jhbuild environment? Just guessing.

[0] https://git.gnome.org/browse/gtk+/tree/gtk/gtkbuilder.loc
[1] https://git.gnome.org/browse/gtk+/tree/gtk/gtkbuilder.its
[2] https://git.gnome.org/browse/gnome-control-center/tree/panels/background/background.ui
Comment 35 Bastien Nocera 2018-01-24 16:30:19 UTC
> $ ninja -v -C _build/ gnome-control-center-2.0-pot 
> ninja: Entering directory `_build/'

No, your jhbuild is using a different build directory than the default. Mine is completely out of tree:
jhbuild/defaults.jhbuildrc:buildroot = os.path.join(xdg_cache_home, 'jhbuild', 'build')

I guess the current code only works when the build directory is a sub-directory of the source directory.
Comment 36 Iñigo Martínez 2018-01-24 17:29:51 UTC
It's still working here:

$ ninja -v gnome-control-center-2.0-pot 
[0/1] /usr/bin/python3 /usr/bin/meson --internal commandrunner /home/imartinez/jhbuild/checkout/gnome-control-center /home/imartinez/.cache/jhbuild/build/gnome-control-center po /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot --pkgname=gnome-control-center-2.0 --datadirs=/home/imartinez/jhbuild/checkout/gnome-control-center/gettext --extra-args=--flag=g_dngettext:2:pass-c-format@@--keyword=_@@--flag=g_string_printf:2:c-format@@--flag=g_string_append_printf:2:c-format@@--from-code=UTF-8@@--flag=C_:2:pass-c-format@@--keyword=NC_:1c,2@@--keyword=N_@@--add-comments@@--keyword=g_dcgettext:2@@--keyword=g_dngettext:2,3@@--flag=NC_:2:pass-c-format@@--flag=g_error_new:3:c-format@@--flag=N_:1:pass-c-format@@--keyword=C_:1c,2@@--flag=g_set_error:4:c-format@@--keyword=g_dpgettext2:2c,3@@--flag=g_strdup_printf:1:c-format

I've also tried using a build directory in the tmp directory, which is also out of tree:

$ ninja -v gnome-control-center-2.0-pot
[0/1] /usr/bin/python3 /usr/bin/meson --internal commandrunner /home/imartinez/gnome/gnome-control-center /tmp/gcc-build po /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gettext pot --pkgname=gnome-control-center-2.0 --datadirs=/home/imartinez/gnome/gnome-control-center/gettext --extra-args=--from-code=UTF-8@@--add-comments@@--flag=g_set_error:4:c-format@@--keyword=N_@@--flag=NC_:2:pass-c-format@@--keyword=C_:1c,2@@--keyword=_@@--flag=g_dngettext:2:pass-c-format@@--flag=g_string_append_printf:2:c-format@@--keyword=g_dngettext:2,3@@--keyword=g_dcgettext:2@@--flag=C_:2:pass-c-format@@--flag=g_strdup_printf:1:c-format@@--keyword=NC_:1c,2@@--flag=g_error_new:3:c-format@@--flag=g_string_printf:2:c-format@@--flag=N_:1:pass-c-format@@--keyword=g_dpgettext2:2c,3
Comment 37 Bastien Nocera 2018-01-24 18:01:12 UTC
The command runs successfully after nuking my build directory, and starting again, but it's not extracting the msgctxt for the Search key entry.

Could it be that I already have an its/loc pair for keybindings installed through the g-c-c package?

$ rpm -qf /usr/share/gettext/its/gnome-keybindings.loc
control-center-3.26.2-2.fc27.x86_64
Comment 38 Iñigo Martínez 2018-01-24 18:16:37 UTC
(In reply to Bastien Nocera from comment #37)
> Could it be that I already have an its/loc pair for keybindings installed
> through the g-c-c package?

Yes, that's the problem. We were yesterday talking about this issue on IRC.

I have filled a bug against gettext: https://savannah.gnu.org/bugs/?52966
Comment 39 Bastien Nocera 2018-01-24 18:43:59 UTC
In which case, and if it works for you, looks fine from my end.
Comment 40 Iñigo Martínez 2018-01-24 19:20:34 UTC
Thanks Bastien.

Piotr, in the meantime, while distributions distribute these files, do you think that a workaround might be necessary to help translators getting and translating these strings?
Comment 41 Piotr Drąg 2018-01-24 19:24:41 UTC
Not really, because GNOME translators are expected to download .pot/.po files from damned-lies, and not clone and build them themselves. Damned-lies uses .its files from git, so it should be all fine (after bug #792829 is fixed).
Comment 42 Iñigo Martínez 2018-01-24 19:50:09 UTC
Comment on attachment 367331 [details] [review]
build: Fix translation context missing from keyboard entries

Pushed as 535d68425 - build: Fix translation context missing from keyboard entries