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 769623 - Replace Intltool with GNU Gettext
Replace Intltool with GNU Gettext
Status: RESOLVED FIXED
Product: sound-juicer
Classification: Applications
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Sound Juicer Maintainers
Sound Juicer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-08 09:59 UTC by Phillip Wood
Modified: 2016-09-06 17:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace Intltool with GNU Gettext (14.25 KB, patch)
2016-08-08 09:59 UTC, Phillip Wood
committed Details | Review
Fix translator comments (9.56 KB, patch)
2016-08-08 10:00 UTC, Phillip Wood
committed Details | Review
Stop translating icon name (2.40 KB, patch)
2016-08-08 10:00 UTC, Phillip Wood
none Details | Review
Use unicode quotes (183.16 KB, patch)
2016-08-08 10:00 UTC, Phillip Wood
none Details | Review
Use proper ellipsis (85.56 KB, patch)
2016-08-08 10:00 UTC, Phillip Wood
none Details | Review
Use unicode quotes (3.93 KB, patch)
2016-08-11 09:36 UTC, Phillip Wood
committed Details | Review
Use proper ellipsis (1.75 KB, patch)
2016-08-11 09:36 UTC, Phillip Wood
committed Details | Review
Add some translator comments to desktop file (1.56 KB, patch)
2016-08-12 12:20 UTC, Phillip Wood
committed Details | Review
Stop translating icon name (3.01 KB, patch)
2016-08-12 12:20 UTC, Phillip Wood
committed Details | Review
Remove X-GNOME-FullName key from desktop file (1.02 KB, patch)
2016-08-12 12:20 UTC, Phillip Wood
committed Details | Review
Fix translator comment (1.24 KB, patch)
2016-09-06 17:14 UTC, Phillip Wood
committed Details | Review

Description Phillip Wood 2016-08-08 09:59:52 UTC
GNU gettext is now actively maintained upstream which intltool isn’t
and it can handle all the files we need to translate.
Comment 1 Phillip Wood 2016-08-08 09:59:57 UTC
Created attachment 332914 [details] [review]
Replace Intltool with GNU Gettext

GNU Gettext 0.19.6 can translate appdata xml files and it is actively
maintained which Intltool isn't.

xgettext is unable to parse G_GNU_PRINTF annotations so add all the
printf style functions from glib and some relevant ones from gio with
--flag so the c-format comments are preserved to enable msgfmt -c
checks.
Comment 2 Phillip Wood 2016-08-08 10:00:02 UTC
Created attachment 332915 [details] [review]
Fix translator comments

Translator comments need to be prefixed with ‘Translators:’ (NB xgettext
is case sensitive) they must also be on the line immediately preceding
the translated string. Some translator comments were previously missing
from the pot file as they weren’t close enough to the translated
string. Also remove the leading ‘*’ from comment continuation lines as
xgettext passes them verbatim which messes up the appearance of
translator comments in the pot file.  Using a prefix remove some
unrelated comments from the pot file.
Comment 3 Phillip Wood 2016-08-08 10:00:07 UTC
Created attachment 332916 [details] [review]
Stop translating icon name

Gettext automatically extracts the icon name from the desktop file for
translation¹ because it is a locale string in the desktop entry
specification.² However we don’t want it translated. As it’s not
possible to specify per-language keywords to stop xgettext from
extracting the string use sed to remove it from the pot file.

¹ https://savannah.gnu.org/support/?108887
² http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
Comment 4 Phillip Wood 2016-08-08 10:00:14 UTC
Created attachment 332917 [details] [review]
Use unicode quotes

xgettext has an option to enforce unicode quotes in translated strings
so lets use it.
Comment 5 Phillip Wood 2016-08-08 10:00:20 UTC
Created attachment 332918 [details] [review]
Use proper ellipsis

xgettext has an option to enforce using ‘…’ instead of ‘...’ so lets
use it. Unfortunately it doesn’t actually pick up the ellipsis in the
UI as it’s not at the end of the string or followed by a space :-(
Comment 6 Petr Kovar 2016-08-09 16:11:55 UTC
Review of attachment 332917 [details] [review]:

I'm not sure if changing the target strings in PO files is a good idea here. Different languages have different typographic rules and it should be up to language maintainers to decide which characters to use. I'd suggest changing the msgid's only.
Comment 7 Petr Kovar 2016-08-09 16:14:35 UTC
Review of attachment 332914 [details] [review]:

Have you tested this with l10n.gnome.org yet?

If not, we could push the patches to a wip branch and set up a dummy module branch in the Damned Lies admin interface to see if it works.
Comment 8 Piotr Drąg 2016-08-09 16:31:20 UTC
FWIW, I use https://git.gnome.org/browse/gtk+/tree/make-pot to test gettext changes locally. You just need to adjust it for another module (replace gtk30 with sound-juicer, for example.)


Also, I agree with Petr that changing PO files is usually a bad idea. Just update the code, and leave the rest to translators.
Comment 9 Phillip Wood 2016-08-11 09:36:20 UTC
Created attachment 333101 [details] [review]
Use unicode quotes

xgettext has an option to enforce unicode quotes in translated strings
so lets use it.
Comment 10 Phillip Wood 2016-08-11 09:36:27 UTC
Created attachment 333102 [details] [review]
Use proper ellipsis

xgettext has an option to enforce using ‘…’ instead of ‘...’ so lets
use it. Unfortunately it doesn’t actually pick up the ellipsis in the
UI as it’s not at the end of the string or followed by a space :-(
Comment 11 Phillip Wood 2016-08-11 09:52:00 UTC
(In reply to Petr Kovar from comment #7)
> Review of attachment 332914 [details] [review] [review]:
> 
> Have you tested this with l10n.gnome.org yet?
> 
> If not, we could push the patches to a wip branch and set up a dummy module
> branch in the Damned Lies admin interface to see if it works.

Thanks for your and Piotr's feedback on editing the PO files I've updated the patches to only change the source strings. I've pushed the changes to wip/gettext, I don't know anything about l10n.gnome.org (or have any permissions to add/change things there) - if you have time to check it works that would be really helpful.  Do you know if damned lies avoids extracting the the icon name for translation?
Comment 12 Phillip Wood 2016-08-11 09:54:08 UTC
(In reply to Piotr Drąg from comment #8)
> FWIW, I use https://git.gnome.org/browse/gtk+/tree/make-pot to test gettext
> changes locally. You just need to adjust it for another module (replace
> gtk30 with sound-juicer, for example.)

Thanks is that a better approximation to what damned-lies does than make sound-juicer.pot?

> Also, I agree with Petr that changing PO files is usually a bad idea. Just
> update the code, and leave the rest to translators.
I've updated the patches now.
Comment 13 Piotr Drąg 2016-08-11 16:32:43 UTC
(In reply to Phillip Wood from comment #11)
> Thanks for your and Piotr's feedback on editing the PO files I've updated
> the patches to only change the source strings. I've pushed the changes to
> wip/gettext, I don't know anything about l10n.gnome.org (or have any
> permissions to add/change things there) - if you have time to check it works
> that would be really helpful.  Do you know if damned lies avoids extracting
> the the icon name for translation?

I tested the branch locally and generating .pot file seems to be working, except for extraction of "X-GNOME-FullName" in the .desktop file (isn't that line obsolete, anyway?) and removing "Icon" - but that's probably because of my setup.

XGETTEXT_OPTIONS looks like an overkill to me, but if you say the flags are needed, then I certainly believe you. :)

And no, damned-lies doesn't do anything with the icon name. I've been adding comments to .desktop files to avoid at least some mistranslations:

https://git.gnome.org/browse/polari/commit/?id=98f8a386079e41f1f73bb16a7a046a299294e387


(In reply to Phillip Wood from comment #12)
> (In reply to Piotr Drąg from comment #8)
> > FWIW, I use https://git.gnome.org/browse/gtk+/tree/make-pot to test gettext
> > changes locally. You just need to adjust it for another module (replace
> > gtk30 with sound-juicer, for example.)
> 
> Thanks is that a better approximation to what damned-lies does than make
> sound-juicer.pot?
> 

Damned-lies can't run autogen.sh/make. See bug #755466.

> > Also, I agree with Petr that changing PO files is usually a bad idea. Just
> > update the code, and leave the rest to translators.
> I've updated the patches now.

Thank you!
Comment 14 Phillip Wood 2016-08-12 12:20:06 UTC
Created attachment 333177 [details] [review]
Add some translator comments to desktop file

Gettext automatically extracts the icon name from the desktop file for
translation¹ because it is a locale string in the desktop entry
specification.² However we don’t want it translated so add a comment to
this effect. Also add a comment that the translated keyword list must
contain semicolons.

Thanks to Piotr Drąg for suggesting these changes.

¹ https://savannah.gnu.org/support/?108887
² http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
Comment 15 Phillip Wood 2016-08-12 12:20:11 UTC
Created attachment 333178 [details] [review]
Stop translating icon name

Gettext automatically extracts the icon name from the desktop file for
translation¹ because it is a locale string in the desktop entry
specification.² However we don’t want it translated. As it’s not
possible to specify per-language keywords to stop xgettext from
extracting the string use sed to remove it from the pot file.

Note that we need to leave the translator comment about the icon name
in the desktop file for users of damned-lies as it does not run make
to extract the strings and ends up extracting the icon name. The changes
to the makefile rule to build the translated desktop file should protect
us from any accidental translations.

¹ https://savannah.gnu.org/support/?108887
² http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
Comment 16 Phillip Wood 2016-08-12 12:20:16 UTC
Created attachment 333179 [details] [review]
Remove X-GNOME-FullName key from desktop file

This is deprecated. As far as I can tell it is not used by
gnome-shell.  It is hard to get xgettext to extract it as it's not one
of the keys xgettext extracts be default.
Comment 17 Phillip Wood 2016-08-12 12:30:46 UTC
(In reply to Piotr Drąg from comment #13)
> (In reply to Phillip Wood from comment #11)
> I tested the branch locally and generating .pot file seems to be working,
> except for extraction of "X-GNOME-FullName" in the .desktop file (isn't that
> line obsolete, anyway?) and removing "Icon" - but that's probably because of
> my setup.
Thanks for testing it. If you used a shell script rather than autogen.sh && make sound-juicer.po then it won't remove the icon name. I think the "X-GNOME-FullName" key is deprecated - I check some modern GNOME apps and they don't use it. GIO has a function to retrieve it but gnome-shell/mutter don't use it as far as I could see.

> XGETTEXT_OPTIONS looks like an overkill to me, but if you say the flags are
> needed, then I certainly believe you. :)
You're right but I decided to take a completest approach as I don't rate my chances of remembering to add new functions in the future. It also means that any contributors don't have to worry if they use any glib/gio functions that are not in the code base right now. I don't think there's any harm to having then there. Personally I'd like libraries to be able to install a file to tell gettext what printf/scanf style functions they have so the developer can just pass one flag per library. Though that approach would be more complicated for language bindings that use GObject Introspection.

> And no, damned-lies doesn't do anything with the icon name. I've been adding
> comments to .desktop files to avoid at least some mistranslations:
> 
> https://git.gnome.org/browse/polari/commit/
> ?id=98f8a386079e41f1f73bb16a7a046a299294e387
Thanks I've done the same. Also the makefile rule for generating the translated desktop file ignores translations for the "Icon" key.

Thanks for your help. Is there anything else that needs addressing or are you happy for me to push these changes?
Comment 18 Piotr Drąg 2016-08-12 19:58:41 UTC
Looks good to me!
Comment 19 Phillip Wood 2016-08-16 10:30:15 UTC
Thanks very much Petr and Piotr your comments and feedback have been
really helpful.

Attachment 332914 [details] pushed as 006cf24 - Replace Intltool with GNU Gettext
Attachment 332915 [details] pushed as 588a52a - Fix translator comments
Attachment 333101 [details] pushed as c7a5715 - Use unicode quotes
Attachment 333102 [details] pushed as c2f91bc - Use proper ellipsis
Attachment 333177 [details] pushed as 00e72da - Add some translator comments to desktop file
Attachment 333178 [details] pushed as 10f423b - Stop translating icon name
Attachment 333179 [details] pushed as 04feadc - Remove X-GNOME-FullName key from desktop file
Comment 20 Daniel Boles 2016-08-28 21:00:46 UTC
small one: re the comments about leading asterisks in continued comment lines, I think you missed a couple here. HTH


diff --git a/src/sj-about.c b/src/sj-about.c
index 074ebb3..e61639b 100644
--- a/src/sj-about.c
+++ b/src/sj-about.c
@@ -74,7 +74,7 @@ void show_about_dialog (void)
                          "documenters", documentors,
                          "artists", artists,
                          /*
-                          * Note to translators: put here your name and email so it will show
+                          * Translators: put here your name and email so it will show
                           * up in the "about" box
                           */
                          "translator-credits", _("translator-credits"),
Comment 21 Phillip Wood 2016-09-03 16:13:24 UTC
(In reply to db0451 from comment #20)
> small one: re the comments about leading asterisks in continued comment
> lines, I think you missed a couple here. HTH
> 
> 
> diff --git a/src/sj-about.c b/src/sj-about.c
> index 074ebb3..e61639b 100644
> --- a/src/sj-about.c
> +++ b/src/sj-about.c
> @@ -74,7 +74,7 @@ void show_about_dialog (void)
>                           "documenters", documentors,
>                           "artists", artists,
>                           /*
> -                          * Note to translators: put here your name and
> email so it will show
> +                          * Translators: put here your name and email so it
> will show
>                            * up in the "about" box
>                            */
>                           "translator-credits", _("translator-credits"),

Well spotted, thanks for letting me know, I'll fix that.
Comment 22 Phillip Wood 2016-09-06 17:14:20 UTC
Created attachment 334923 [details] [review]
Fix translator comment

This one was missed when removing the asterisks from translator
comments. See commit 588a52a.
Comment 23 Phillip Wood 2016-09-06 17:17:45 UTC
Comment on attachment 334923 [details] [review]
Fix translator comment

Attachment 334923 [details] pushed as 4fe2a8f - Fix translator comment