GNOME Bugzilla – Bug 572218
Order of variables not changeable
Last modified: 2009-02-18 16:37:48 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
Created attachment 128931 [details] [review] Simple patch to fix reordering I didn't test it's functionality, but l10n is working now :).
(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):
+ Trace 212643
(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"
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.
Created attachment 128933 [details] [review] Simple patch to fix reordering I didn't test it's functionality, but l10n is working now :).
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
(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. :-(
(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.
Isn't it just a case that you need to use this? %2$d. szint %1$s
(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
Told you so... ;) http://mail.gnome.org/archives/gnome-i18n/2009-February/msg00168.html
Created attachment 128994 [details] [review] Final patch committed Patch committed. Closing.