Package: gettext
Version: 0.18.1.1-1ubuntu2
Severity: normal
Tags: upstream

I've stumbled on this issue recently, and while searching if this was
already reported somewhere, I've found upstream bug #30854 in Savannah. Looks
like it wasn't forwarded to neither the old nor the new bug mailing list,
so I'll do it now, make his words mine, and add a few comments on my own:

Mon 23 Aug 2010 05:10:05 PM GMT, original submission by David Planella
https://savannah.gnu.org/bugs/index.php?30854
---------------
Currently the gettext tools support only the old Python string format for
substitutions, that is, %s or %(variable)s type strings.

Python standards PEP 0292 [1] and PEP 3101 [2] recommend the use of $foo
and {foo} strings. More and more Python applications migrate to this new
syntax, and it would make sense for the gettext tools to support it.

The ones I can think, off the top of my head:

    xgettext to extract {foo} and $foo strings from Python files and mark
    them as python-format in the .pot templates
    msgmerge -c to validate those

[1] http://www.python.org/dev/peps/pep-0292/
[2] http://www.python.org/dev/peps/pep-3101/
-----------------

I think he means msgfmt -c, since AFAIK there's no msgmerge -c

A few remarks on my own:

The 3 formats currently co-exist in Python 2:
  %(foo)s is used by the % operator, as in "%(foo)s" % {'foo':bar}
  {foo}   is used by the str.format() method and format() builtin,
          as in "{foo}".format(foo=bar) or format("{foo}",foo=bar)
  $foo    is used by the Template class, as in "$foo".Template(foo=bar)

The % format is deprecated in Python 3, and, while still widely used in
Python 2, its usage for new code is discouraged. format() is the new
standard. See http://docs.python.org/library/stdtypes.html#str.format

That said, I urge gettext to support at least the new format() syntax. If
it's not possible to support 3 different syntax rules simultaneously, at
least give Python users a way to choose one of the sets, using xgettext's
--flag for example



-- System Information:
Debian Release: squeeze/sid
  APT prefers maverick-updates
  APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500,
'maverick-backports'), (500, 'maverick')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-32-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gettext depends on:
ii  dpkg               1.15.8.4ubuntu3.1     Debian package management system
ii  gettext-base       0.18.1.1-1ubuntu2     GNU Internationalization utilities
ii  install-info       4.13a.dfsg.1-5ubuntu1 Manage installed documentation in
ii  libc6              2.12.1-0ubuntu10.4    Embedded GNU C Library: Shared lib
ii  libcroco3          0.6.2-1               a generic Cascading Style Sheet (C
ii  libglib2.0-0       2.26.1-0ubuntu1       The GLib library of C routines
ii  libgomp1           4.5.1-7ubuntu2        GCC OpenMP (GOMP) support library
ii  libncurses5        5.7+20100626-0ubuntu1 shared libraries for terminal hand
ii  libunistring0      0.9.3-1               Unicode string library for C
ii  libxml2            2.7.7.dfsg-4ubuntu0.4 GNOME XML library

Versions of packages gettext recommends:
ii  curl                   7.21.0-1ubuntu1.3 Get a file from an HTTP, HTTPS or
ii  wget                   1.12-1.1ubuntu3   retrieves files from the web

Versions of packages gettext suggests:
pn  gettext-doc                   <none>     (no description available)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to