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 572218 - Order of variables not changeable
Order of variables not changeable
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: i18n
2.25.x
Other Linux
: Normal normal
: ---
Assigned To: Willie Walker
Depends on:
Blocks:
 
 
Reported: 2009-02-17 22:44 UTC by Gabor Kelemen
Modified: 2009-02-18 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple patch to fix reordering (1.23 KB, patch)
2009-02-17 23:00 UTC, Gabor Kelemen
none Details | Review
Simple patch to fix reordering (1.23 KB, patch)
2009-02-17 23:30 UTC, Gabor Kelemen
none Details | Review
Final patch committed (1.98 KB, patch)
2009-02-18 16:30 UTC, Willie Walker
committed Details | Review

Description Gabor Kelemen 2009-02-17 22:44:58 UTC
#. Translators: the %d is in reference to a heading
#. level in HTML (e.g., For <h3>, the level is 3)
#. and the %s is in reference to a previously
#. translated rolename for the heading.  If you
#. change the order of the %s and %d in the string
#. (as needed for Hungarian, for example), Orca will
#. detect it and do the right thing.
#.
#: ../src/orca/scripts/toolkits/Gecko/speech_generator.py:93
#, python-format

%s level %d

Changing the order in this does not work in this form. Orca may do the right thing, but gettext will barf errors if I try this:

%2$d. szint %1$s
->
./hu.po:7203: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: In the directive number 1, the character '$' is not a valid conversion specifier.
msgfmt: found 1 fatal error

%d. szint %s
->
./hu.po:7203: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same
msgfmt: found 1 fatal error

Pleas use the standard Python way for this:
http://www.gnu.org/software/gettext/manual/html_node/Python.html#Python
Comment 1 Gabor Kelemen 2009-02-17 23:00:11 UTC
Created attachment 128931 [details] [review]
Simple patch to fix reordering

I didn't test it's functionality, but l10n is working now :).
Comment 2 Willie Walker 2009-02-17 23:19:01 UTC
(In reply to comment #0)
> Changing the order in this does not work in this form. Orca may do the right
> thing, but gettext will barf errors if I try this:
> 
> %2$d. szint %1$s
> ->
> ./hu.po:7203: 'msgstr' is not a valid Python format string, unlike 'msgid'.
> Reason: In the directive number 1, the character '$' is not a valid conversion
> specifier.

I think the problem is the '$' in the translated string and it may happen regardless of whether parameterized formatting is used or not:

bash-3.2$ python
Python 2.4.4 (#1, Dec 15 2008, 02:59:59) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> print "%2$d." % 5
Traceback (most recent call last):
  • File "<stdin>", line 1 in ?
ValueError: unsupported format character '\$' (0x24) at index 2

Comment 3 Willie Walker 2009-02-17 23:21:04 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > %2$d. szint %1$s

So, I think this probably should be translated as "%d. szint %s"
Comment 4 Willie Walker 2009-02-17 23:24:55 UTC
Please see also:
http://mail.gnome.org/archives/gnome-i18n/2009-February/msg00169.html
http://mail.gnome.org/archives/gnome-i18n/2009-February/msg00171.html

I really don't want to introduce the parameterized form unless we need to.  My experiences have shown that translators are overly aggressive in what they translate.  So, it is highly likely they will end up translating the parameterization strings that should *not* be translated.
Comment 5 Gabor Kelemen 2009-02-17 23:30:48 UTC
Created attachment 128933 [details] [review]
Simple patch to fix reordering

I didn't test it's functionality, but l10n is working now :).
Comment 6 Gabor Kelemen 2009-02-17 23:38:40 UTC
oops, sorry for double posting the patch. 

$ grep -C2 \(level\) hu.po
#: ../src/orca/scripts/toolkits/Gecko/speech_generator.py:93
#, python-format
msgid "%(role)s level %(level)d"
msgstr "%(szint)d. szint %(szerep)s"

gabor@shaihulud:~/forras/orca/po$ msgfmt -cvo /dev/null hu.po
hu.po:7200: a format specification for argument 'level' doesn't exist in 'msgstr'
msgfmt: found 1 fatal error
1270 translated messages.

So, if I translate the parameters, gettext catches it. Currently, a comment and this is the only measure against stupidity, they are quite good I think, as damned-lies will highlight it very visibly. On the other hand, other modules are using this, we are accustomed to it, and we know that this is for making *our* job easier.

And yes, I think this is a case when it's necessary. No other way would work, see above: 

%d. szint %s
->
./hu.po:7203: format specifications in 'msgid' and 'msgstr' for argument 1 are
not the same
msgfmt: found 1 fatal error
Comment 7 Willie Walker 2009-02-18 00:40:02 UTC
(In reply to comment #6)
> %d. szint %s
> ->
> ./hu.po:7203: format specifications in 'msgid' and 'msgstr' for argument 1 are
> not the same
> msgfmt: found 1 fatal error

Sigh, I must've had a different version of intltool than you because my testing didn't show this.  OK, I'll make the change and do the string break request.  It will take a while now that we're in string freeze.  :-(
Comment 8 Willie Walker 2009-02-18 00:44:35 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > %d. szint %s
> > ->
> > ./hu.po:7203: format specifications in 'msgid' and 'msgstr' for argument 1 are
> > not the same
> > msgfmt: found 1 fatal error
> 
> Sigh, I must've had a different version of intltool than you because my testing
> didn't show this. 

BTW - it also seemed to work for Hammer Attila: http://bugzilla.gnome.org/show_bug.cgi?id=561660#c38

Nonetheless, we'll shoot for parameterized form due to the mixed results.
Comment 9 F Wolff 2009-02-18 10:17:08 UTC
Isn't it just a case that you need to use this?
%2$d. szint %1$s

Comment 10 Willie Walker 2009-02-18 12:50:47 UTC
(In reply to comment #9)
> Isn't it just a case that you need to use this?
> %2$d. szint %1$s

See http://bugzilla.gnome.org/show_bug.cgi?id=572218#c2
Comment 11 Wouter Bolsterlee (uws) 2009-02-18 16:12:28 UTC
Told you so... ;) http://mail.gnome.org/archives/gnome-i18n/2009-February/msg00168.html
Comment 12 Willie Walker 2009-02-18 16:30:19 UTC
Created attachment 128994 [details] [review]
Final patch committed

Patch committed.  Closing.