[Python-Dev] pygettext() without newlines (Was: Re: Replacement for print in Python 3.0)
Martin Blais
martin.blais at gmail.com
Sun Sep 11 18:35:08 CEST 2005
On 9/11/05, skip at pobox.com <skip at pobox.com> wrote:
>
> (Maybe someone else has already raised this point. I'm a bit behind.)
>
> Martin> Here goes something: for applications targeted to the web, where
> Martin> newlines don't matter, the line breaks in _()'ed strings are
> Martin> superfluous.
>
> How will you know you're generating output that goes between <pre> and
> </pre> (where newlines do matter)?
The great majority of the strings are _(), but in my web app framework
I use __() for that specific purpose you mention, which invokes the
"normal" behaviour of pygettext (which my patch doesn't remove, BTW).
Here is how I invoke pygettext from my Makefile:
POTCMD = pygettext.py \
--verbose --extract-all --no-default-keywords \
--keyword-single=_ --keyword-single=N_ \
--keyword=__
I use _() and N_() for single-line'd strings (runtime and marker-only
versions), and __() for the usual multi-line strings. It works well,
I've been using this for a while on a web application I'm building.
cheers,
More information about the Python-Dev
mailing list