bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] [PATCH 0/3] Support for Python format strings in brace


From: Stefano Lattarini
Subject: Re: [bug-gettext] [PATCH 0/3] Support for Python format strings in braced syntax
Date: Fri, 14 Dec 2012 10:31:54 +0100

Hi Daiki.

On 12/14/2012 09:47 AM, Daiki Ueno wrote:
> Hi,
> 
> These patches are the first step to support Python's new format
> strings, requested a while ago:
> <http://lists.gnu.org/archive/html/bug-gettext/2012-04/msg00007.html>
> 
> Currently, only braced syntax is supported, which looks like:
> 
>   _("foo {bar} baz").format(bar="bar")
> 
> As Rodrigo noted in the mail, the format strings should be only valid
> when they are used with string.format function.  Unfortunately, the
> current xgettext Python backend scans the function calls from left to
> right, and so the implementation wouldn't be straightforward.
> 
> The current approach looks for dot-keyword after right parenthesis,
> and if found, transform the expression into something like:
> 
>   .format(_("foo {bar} baz")).format(bar="bar")
> 
> and then rescan the token stream.
> 
> Since this is my first non-trivial patch for gettext, Any comments
> would be appreciated.  Of course, this is not intended for 0.18.2.
>
I think all the useful explanation you have given in this mail
should go in the commit message of the first patch.  That way,
future developers will be able to understand the big picture of
the commit at a glance, reading the commit message, rather than
trying to deduce it by reading the details of the change.

And probably, you might also want to insert a version of such
explanation (maybe abridged, or expanded) also in strategically
placed comments in the new code.

Just my 2 cents, and hope that helps,
  Stefano



reply via email to

[Prev in Thread] Current Thread [Next in Thread]