|
|
Log in / Subscribe / Register

Mozilla releases a machine-translation plugin

Mozilla releases a machine-translation plugin

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

I was just translating a karaoke program recently, and "queue" being used as a verb (to add to the queue) as well as the noun (title of the page displaying the queue) was impossible to even translate with `gettext`. I ended up having to ask upstream to use "enqueue" for the verb form to get it translated.

I think getting the verb / noun versions wrong (some languages they do *not* overlap) is more confusing than leaving it in English, at least for the target audience I was translating for (my partner's parents know a little english, but prefer Chinese strongly).


to post comments

Mozilla releases a machine-translation plugin

Posted Jun 9, 2022 16:13 UTC (Thu) by nye (subscriber, #51576) [Link] (1 responses)

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.

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