Skip to content

Automatic LLM Translations #2338

Closed
Closed

Description

@christian-egger-augedo

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 .po files (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 .po files, 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 compile and extract. It could be called translate.

In my script i use gpt-4o to 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:

  • To run the script, the users need a OPENAI_API_KEY env 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

Activity

  1. andrii-bodnar commented on Oct 9, 2025

    @andrii-bodnar
    Contributor

    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 linguito translate command that uses a configurable LLM to automatically fill in missing .po strings, often including an option for interactive review.

    Please take a look at this and let us know what you think.

  2. christian-egger-augedo commented on Oct 10, 2025

    @christian-egger-augedo
    Author

    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 translate should be part of lingui itself. AI in development has really landed and I feel like it is to be considered as part of our standard workflows these days. And while linguito brings that functionality, it also adds other things that are already part of lingui.

    • the linguito check essentially does the same as lingui extract (that will also tell you about any missing translations)
    • the linguito format does some formatting + removes empty translations (which is done by the --clean flag already in lingui).

    So aside from the translate i don't think it adds a lot of inherent value but rather provides a different interface to interact with lingui. Which other people surely find valuable!! Im a big fan of keeping my web-dev stack as slim as possible, having been traumatized of create-react-app and the likes.

    And to me it feels very natural to have the three

    1. lingui extract
    2. lingui translate
    3. lingui compile

    because translate bridges the other two commands as a natural part of the workflow.

    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! 🚀

  3. andrii-bodnar commented on Oct 10, 2025

    @andrii-bodnar
    Contributor

    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 OPENAI_API_KEY configuration, specifically for the extract command. We could use AI to automatically generate a helpful comment for the string based on its location and context in the code. This feature should improve the context provided to both AI and human linguists, leading to higher-quality translations.

    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.

  4. locked and limited conversation to collaborators on Oct 10, 2025
  5. converted this issue into a discussion #2342 on Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions