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

Martin Blais blais at furius.ca
Fri Apr 7 16:13:14 CEST 2006


On 4/7/06, M.-A. Lemburg <mal at egenix.com> wrote:
> Martin Blais wrote:
> > Hi all
> >
> > I got an evil idea for Python this morning -- Guido: no, it's not
> > about linked lists :-) -- , and I'd  like to bounce it here.  But
> > first, a bit of context.
>
> This has been discussed a few times before, see e.g.
>
> http://mail.python.org/pipermail/python-list/2000-January/020346.html

Oh, wow, thanks!


> In summary, the following points were made in the various
> discussions (this is from memory, so I may have forgotten
> a few points):
>
> * the string literal modifiers r"" and u"" are really only a cludge
>   which should not be extended to other uses
>
> * being able to register such modifiers would result in unreadable
>   and unmaintainable code, since the purpose of the used modifiers
>   wouldn't be clear to the reader of a code snippet
>
> * writing i"" instead of _("") saves two key-strokes - not really
>   enough to warrant the change
>
> * if you want to do it right, you'd also have to add iu"",
>   ir"" for completeness

Good points.  Thanks for summarizing.  It's certainly true that adding
a general mechanism to hook custom calls into strings initialization
may cause confusion if people define them differently.


> * internationalization requires a lot more than just calling
>   a function: context and domains are very important when it
>   comes to translating strings in i18n efforts; these can
>   easily be added to a function call as parameter, but not
>   to a string modifier

Sure, but the simple case covers 99% the great majority of the uses.


> * there are lots of tools to do string extraction using the
>   _("") notation (which also works in C); for i"" such tools
>   would have to be rewritten

(I don't really see this as a problem.)


More information about the Python-Dev mailing list