|
|
Log in / Subscribe / Register

Mozilla releases a machine-translation plugin

Mozilla releases a machine-translation plugin

Posted Jun 9, 2022 16:13 UTC (Thu) by nye (subscriber, #51576)
In reply to: Mozilla releases a machine-translation plugin by tbelaire
Parent article: Mozilla releases a machine-translation plugin

Excuse my gettext ignorance, but why can't contexts be used to solve this? I thought the point of them is to allow the same text to be translated in different ways according to the context. Surely gettext can't get this that badly wrong?

This is such a common standard issue in translation that any translation tool that can't handle it is barely even a toy IMO.


to post comments

Mozilla releases a machine-translation plugin

Posted Jun 9, 2022 17:40 UTC (Thu) by tbelaire (subscriber, #141140) [Link]

Ok, well here it is.

https://github.com/vicwomg/pikaraoke/blob/master/template...

I have it hooked up with pybabel and flask_babel, and jinja2.ext.i18n for inflating the templates. I see the context correctly when editing the translation files, but I don't think the context is used for a lookup? That would be pgettext right?

https://docs.python.org/3/library/gettext.html#gettext.pg...

Oh, I see that the jinja2 extension mentions pgettext

https://jinja.palletsprojects.com/en/3.1.x/extensions/#i1...

But I'm not sure how to wire it up to the {% trans %} blocks, and it was easier to just upstream it. I was doing this as a hobby and I'm not a pro in this area.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds