[Python-Dev] The "i" string-prefix: I18n'ed strings

Martin Blais blais at furius.ca
Fri Apr 7 16:23:05 CEST 2006

On 4/7/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Martin Blais wrote:
> >> P(a("Click here to forget", href="...
> >
> > No. That's not going to work: pygettext needs to be able to extract
> > the string for the catalogs.  No markup, no extraction.  (This is how
> > you enter strings that are not meant to be translated.)
> I know; I wrote pygettext. You can pass the set of functions that count
> as marker with -k/--keyword arguments.
> >> You could it also write as
> >>
> >> P(A_("Click here to forget", href="...
> >>
> >> to make it a little more obvious to the reader that there is a
> >> gettext lookup here.
> >
> > This is not generic enough, HTML is too flexible to hard-code all
> > cases.  This only would help slightly.
> I don't understand. What case that you would like to express
> couldn't be expressed?

Hmmm thinking about this more, I think you're right, I do want to i18n
all the strings passed in to HTML builder classes as positional
arguments, and so I should make all the HTML tags keywords for
pygettext, this would cover the majority of strings in my application.

I'm not sure all the cases are handled, but for those which aren't I
can't see why I couldn't hack the pygettext parser to make it do what
I want, e.g. is the case were the function contains multiple strings
handled? ::

  P(A_("Status: ", get_balance(), "dollars", href=".... ")

(No need to answer to list, this is getting slightly OT, I'll check it
out in more detail.)

More information about the Python-Dev mailing list