Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate i18n POT file updates in PRs #17733

Open
webknjaz opened this issue Mar 8, 2025 · 0 comments
Open

Automate i18n POT file updates in PRs #17733

webknjaz opened this issue Mar 8, 2025 · 0 comments
Labels
i18n Internationalization translation Issues relating to PyPI translations

Comments

@webknjaz
Copy link
Member

webknjaz commented Mar 8, 2025

          > It'd be a good idea to have automation that would do this on its own. A-la pre-commit.ci. Would you be open to exploring this? I'm pretty confident I know how to implement it.

This is an interesting idea, and I'd very much be open to learning more about this! One of the challenges is how to manage merge conflicts on this kind of thing, so I'm curious how you might approach that as well. #6631 has some background on translation workflow ideas

Originally posted by @miketheman in #17602 (comment)


@miketheman yeah, I was around back then but forgot about that thread :)

FWIW, my current idea was to do the same as the status quo but automatically. It doesn't handle merge conflicts. When a PR has conflicts, the CI doesn't run and usually no integrations run either.

Though it's worth noting that I've since implemented a somewhat different workflow over @ PyPUG — we have no POT file, nor do we have POs/MOs in the default branch. But there's a separate branch translation/source which does. Whenever a PR is merged into the main branch, the CI merges main into translation/source. And this is how the POT file remains up-to-date. Weblate is configured to work with translation/source too — it sources POT from it and sends PR with translated files against this branch as well.
So both POT and POs end up in translation/source. The process is unidirectional and there are no flows that would attempt updating the same files. translation/source is also never merged back into main.
So main only holds the original English version. It's the source of truth.
And RTD is set up to build from translation/source and not main too.

graph LR

  subgraph "🌵 'pypa/packaging.python.org'"
    branch:translations["🌿 'translation/source'"]
    branch:main["🌿 'main'"]

    persona:writer("🧔 Writer (produces English text)")
  end

  subgraph "🗂️ Weblate"
    persona:translator("🧔 Translator (produces non-English text)")

    strings:src["📝 Source strings (English)"]
    strings:translated["📝 Translated strings (non-English)"]
  end

  subgraph "📝 ReadTheDocs"
    rtd:br-pt["🇧🇷 Brazillian Portuguese docs"]
    rtd:en["🏴󠁧󠁢󠁥󠁮󠁧󠁿 English docs"]
    rtd:uk["🇺🇦 Ukrainian docs"]
  end

%% Contribution directions:
   persona:writer --1--> branch:main

   branch:main --2: POT file is generated--> branch:translations

   branch:translations --3--> strings:src

   strings:src --4--> persona:translator
   persona:translator --5--> strings:translated
   strings:translated --6: Weblate sends a PR with PO file updates--> branch:translations

   branch:translations --7--> rtd:br-pt
   branch:translations --7--> rtd:en
   branch:translations --7--> rtd:uk
Loading
@webknjaz webknjaz added i18n Internationalization translation Issues relating to PyPI translations labels Mar 8, 2025
@webknjaz webknjaz moved this to 🤔 Brain 🧠 dump 💡 in 📅 Procrastinating in public Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Internationalization translation Issues relating to PyPI translations
Projects
None yet
Development

No branches or pull requests

1 participant