(29.11.2011 07:42), Kees Bos wrote:
>> > I only hoped that someone did it already (in gettext way). I18N from
>> > examples/libtest looks like something I don't like (msg not in "human
>> > language" like _("invoice number %s")%number, but
>> > somemodule.label_of_invoice()%number ).
>> >
> Just for the records, there's a reason for using keys (in this case
> methods) in stead of 'English' words/sentences. In some languages the
> position of the words/sentences on the screen can lead to different
> translations. As long as you stick to western languages, chances are not
> very high that you run into this issue. You can of course use different
> gettext domains if you use two times the same word/sentence, but that's
> a misuse of domains. I've done some reading on this some time ago and
> have lost track references for the i18n issues of gettext.
Yeah, it's problem. But I usually do it in such way, that I override _
function in such way:
def _new_gettext(msg):
return gettext.gettext(msg).split("@")[0]
_ = _new_gettext
In such way I have _("Close@menu") translated to "Zamknij" when it means
what should be done, and _("Close@howfar") => "Blisko" when it means
that it's close/far.
It's homegrown, but always works :)
--
pozdrawiam
Ćukasz Mach
Pagema (http://www.pagema.net)