[GRASS-dev] xgettext grasswxpy issue

hi,

just found this one while running "make pot" (GRASs 6.4.svn):

Generating grasswxpy...
xgettext -k_ -o ./templates/grasswxpy.pot `find ../gui/wxpython -name
'*.py' | xargs grep -l "_(\""`
../gui/wxpython/gui_modules/colorrules.py:391: warning: 'msgid' format
string with unnamed arguments cannot be properly localized:
                                                        The translator
cannot reorder the arguments.
                                                        Please
consider using a format string with named arguments,

Markus

Markus Neteler wrote:

just found this one while running "make pot" (GRASs 6.4.svn):

Generating grasswxpy...
xgettext -k_ -o ./templates/grasswxpy.pot `find ../gui/wxpython -name
'*.py' | xargs grep -l "_(\""`
../gui/wxpython/gui_modules/colorrules.py:391: warning: 'msgid' format string with unnamed arguments cannot be properly localized:
                                                        The translator cannot reorder the arguments.
                                                        Please consider using a format string with named arguments,

391 self.cr_label.SetLabel(_('Enter raster cat values or percents (range = %d-%d)' %
392 (self.rast['min'], self.rast['max'])))

Note that this issue also arises in C: the use of e.g. "%1$d" in
format strings isn't part of C89, although it is in C99 and SUS.

It's almost invariably possible to come up with a form of wording
which preserves the original order, e.g. "(min=%d, max=%d)".

I would guess that this specific case might be an issue for
right-to-left languages (we do have a partial Arabic translation for
grassmods and grasslibs, but not grasswxpy).

If we want to eliminate the warning, the solution is:

            self.cr_label.SetLabel(_('Enter raster cat values or percents (range = %(min)d-%(min)d)' %
                                     dict(min = self.rast['min'], max = self.rast['max'])))

--
Glynn Clements <glynn@gclements.plus.com>

2008/10/12 Glynn Clements <glynn@gclements.plus.com>:

If we want to eliminate the warning, the solution is:

           self.cr_label.SetLabel(_('Enter raster cat values or percents (range = %(min)d-%(min)d)' %
                                    dict(min = self.rast['min'], max = self.rast['max'])))

done in r33838.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *