[Python-ideas] String interpolation for all literal strings
Andrew Barnert
abarnert at yahoo.com
Sat Aug 8 02:24:53 CEST 2015
On Aug 7, 2015, at 09:09, Barry Warsaw <barry at python.org> wrote:
> One other word about i18n based on experience. The escape format *really*
> matters. Keep in mind that we've always had positional interpolation, via
> '%(foo)s', but we found that to be very highly error prone. I can't tell you
> how many times a translator would accidentally leave off the trailing 's',
> thus breaking the translation. It's exactly the reason for string.Template --
> $-strings are familiar to almost all translators, and really hard to screw up.
> I fear that something like \{ (and especially if \} is required) will be as
> error prone as %(foo)s.
Besides the familiarity issue, there's also a tools issue. I've worked on more than one project where we outsourced translation to companies who had (commercial or in-house) tools that recognized $var, ${var}, %s (possibly with the extended format that allows you to put position numbers in), and %1 (the last being a Microsoft thing) but nothing else. I don't know why so many of their tools are so crappy, or why they waste money on them when there are better (and often free) alternatives, but it is an argument in favor of $.
More information about the Python-ideas
mailing list