l10n approach for bzr
Mark Hammond
skippy.hammond at gmail.com
Mon Mar 17 20:56:20 GMT 2008
> class MyError(BzrError):
>
> _fmt = i18n("My Error says %(foo)s")
>
> We would instead do:
>
> class BzrError(...):
>
> def __str__(self):
> l10nfmt = i18n(self._fmt)
> return l10nfmt % self.__dict__
>
>
> And the alternative:
>
> class MyError(BzrError):
>
> _fmt = i18n("M_BZR_MY_ERROR_FMT")
>
> Which gets exceptionally tricky if you are changing the
> number of %s you want to put in the string. You now have to
> go find the format, figure out that it has 3, add the 4th, etc.
Unless I'm missing something, it is already worse than that - you need to
locate *all* existing translations and add the new insert (else a runtime
error formatting the string will occur in some locales but not others) - and
worse, you need to know *where* in the translated text the insert makes
sense?
> So fairly long winded, but my view is that we should use
> English strings for the message ids, and that when the locale
> is English we shouldn't need any translating. Which means
> that when strings are cleaned up, they will get new message ids.
More information about the bazaar
mailing list