Repository navigation
Automatic LLM Translations #2342
Replies: 6 comments 3 replies
|
Hi @christian-egger-augedo, thank you for the suggestion! This is a great idea! The automatic translation feature you described is already offered by the third-party CLI companion tool Linguito: https://github.com/antropia-studio/linguito. Linguito provides a Please take a look at this and let us know what you think. |
|
Linguito looks great. Thanks for pointing it out. Its also interesting to see how they do their translations! I personally think (for what its worth lol) that the
So aside from the And to me it feels very natural to have the three
because With that being said, I just want to present my opinion but don't mean to push it onto anyone, especially not being part of the project! If you don't agree with it, feel free to close the issue! 🚀 |
|
Yes, having that capability out-of-the-box definitely makes the experience feel more natural and intuitive. I was also thinking about a similar enhancement that involves the On a side note, I just noticed a recent message in our Discord server. Someone posted about a different tool they created for AI translation of message catalogs - you can find the message here. |
|
I have suggested a new RFC regarding AI integration in Lingui: #2392. Any feedback is welcome! |
|
Ended up copying my own translation script to various projects, so I just extracted it published it as an NPM package: https://www.npmjs.com/package/lingui-translate Its super easy to use, basically just do Maybe someone finds it useful - I'll be using it for my projects! (note: my work github account is the christian-egger-augedo account above) |
|
Found this looking into a Lingui issue, seems worth mentioning since a few people here are building their own AI translate step. One thing to have in mind is that plurals work differently in Lingui than in the rest of the gettext world. Classic gettext/.po has msgid_plural and indexed slots. Lingui's po format doesn't do that, the ICU string is inline in a single msgstr: So you have to rewrite the categories inside the ICU string to the target locale's CLDR set. English one/other into Polish needs four branches: one, few, many, other etc. Many times it fails quietly, like ask a model to "translate this, preserve the ICU" and you often get back valid ICU with the english categories translated word for word. Nothing errors, then the wrong branch start to show up. |
Uh oh!
There was an error while loading. Please reload this page.
Problem Description
Really love lingui and use it in all my projects!
One things that has bugged me since the advent of AI coding tools such as Cursor: I feel like those IDEs really struggle with translating the
.pofiles (super slow because they usually do it line by line, wonky translations and also incomplete translations when adding many translations at the same time).I find it especially funny because GPTs originally built by Google were meant to be this new way of translating languages and now in the whole development cycle the only thing that I do manually is writing translations.
I wrote some python script for myself that takes
.pofiles, parses missing translations + cleverly adds existing translated strings as context and then automatically translates all missing strings. And now using lingui is SO much fun again.So I was wondering: Is this something you'd be interested in having added to the lingui CLI scripts?
Proposed Solution
Add a standard CLI script, just like
compileandextract. It could be calledtranslate.In my script i use
gpt-4oto do the translations. In theory we could make it model agnostic, however I'm also a big fan of keeping it simple.Requirements to run the script:
OPENAI_API_KEYenv variable.python3(or whatever runtime we want to use to implement this - honstely haven't looked into how your other CLI commands are implemented)Alternatives Considered
Everyone can obviously ask ChatGPT and the likes to build this script from scratch and just run it locally in their repos. That's the way I do it right now.
Additional Context
No response
All reactions