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 791648 - Consider using positional specifier in genitive construction
Consider using positional specifier in genitive construction
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: I18N
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-12-15 08:45 UTC by Reinout van Schouwen
Modified: 2017-12-16 17:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sync-utils: Extend the translator comment to cover switching variables (1.06 KB, patch)
2017-12-15 19:11 UTC, Piotr Drąg
committed Details | Review

Description Reinout van Schouwen 2017-12-15 08:45:43 UTC
#: lib/ephy-sync-utils.c:326
msgid "%s’s GNOME Web on %s"

This does not translate well. Not all languages will have the strings in the same order when using a genitive construction. 

According to https://stackoverflow.com/questions/2459390/localizing-concatenated-or-dynamic-strings we can use positional specifiers, so "%1$s's GNOME Web on %2$s" so we could translate it with the strings in the reverse order. Would this be possible?
Comment 1 Michael Catanzaro 2017-12-15 15:31:37 UTC
Yeah, sure.
Comment 2 Piotr Drąg 2017-12-15 19:11:46 UTC
Created attachment 365601 [details] [review]
sync-utils: Extend the translator comment to cover switching variables
Comment 3 Michael Catanzaro 2017-12-15 21:38:53 UTC
Review of attachment 365601 [details] [review]:

What could possibly go wrong :)
Comment 4 Piotr Drąg 2017-12-15 21:44:01 UTC
(BTW, Saxon genitive is problematic anyway: https://bugzilla.gnome.org/show_bug.cgi?id=767107#c1).
Comment 5 Piotr Drąg 2017-12-15 21:46:27 UTC
Comment on attachment 365601 [details] [review]
sync-utils: Extend the translator comment to cover switching variables

Thanks, pushed: https://git.gnome.org/browse/epiphany/commit/?id=db7a7389b33dcd7715694e25fbfd2ff274add14e

In case you’re wondering, msgfmt should report an error if the variables are malformed.
Comment 6 Michael Catanzaro 2017-12-16 16:14:14 UTC
(In reply to Piotr Drąg from comment #5)
> In case you’re wondering, msgfmt should report an error if the variables are
> malformed.

I don't think it's smart enough to detect when the format string is no longer compatible with the original... we have had language-specific crashes before that turned out to be caused by translators accidentally changing format strings. :/
Comment 7 Piotr Drąg 2017-12-16 17:28:45 UTC
$ cat po/pl.po |grep '$s'
msgstr "Przeglądarka WWW środowiska GNOME użytkownika %3$s na komputerze %4$s"
$ msgfmt -cvo /dev/null po/pl.po
po/pl.po:1647: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: The string refers to argument number 3 but ignores argument number 1.
msgfmt: found 1 fatal error
697 translated messages.

$ cat po/pl.po |grep '$s'
msgstr "Przeglądarka WWW środowiska GNOME użytkownika %$2s na komputerze %1$s"
$ msgfmt -cvo /dev/null po/pl.po
po/pl.po:1647: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: In the directive number 1, the character '$' is not a valid conversion specifier.
msgfmt: found 1 fatal error
697 translated messages.

It seems smart enough. Perhaps you were using non-standard variables (like Nautilus used to have %B and %V), or some erroneous translations got in when msgfmt hook was temporarily broken a few years back?