Skip to content

feat(add-ons): add pot update support#18672

Open
nijel wants to merge 2 commits intoWeblateOrg:mainfrom
nijel:po-update
Open

feat(add-ons): add pot update support#18672
nijel wants to merge 2 commits intoWeblateOrg:mainfrom
nijel:po-update

Conversation

@nijel
Copy link
Member

@nijel nijel commented Mar 26, 2026

  • currently limited to xgettext, Django and Sphinx
  • we have not intention for generic solution here

Fixes #10708
Fixes #18428

@nijel nijel added this to the 5.17 milestone Mar 26, 2026
@nijel nijel requested a review from Copilot March 26, 2026 15:07
@nijel nijel self-assigned this Mar 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for automatically updating POT templates via new gettext-based add-ons (xgettext, Django makemessages, Sphinx gettext builder), including UI guidance and alerts to encourage pairing with msgmerge when PO updates are desired.

Changes:

  • Introduces new “Update POT file” add-ons (xgettext/Django/Sphinx) with scheduling, header normalization, and optional msgmerge integration.
  • Adds new alerts + templates and guideline detection to recommend/add msgmerge when relevant.
  • Extends tests and documentation to cover the new add-ons and behaviors.

Reviewed changes

Copilot reviewed 17 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
weblate/trans/tests/test_guide.py Adds tests for new guideline relevance heuristics (xgettext/Django/Sphinx).
weblate/trans/tests/test_alert.py Adds tests for the new msgmerge guidance alert around POT extraction add-ons.
weblate/trans/models/alert.py Registers new alert types related to POT extraction and msgmerge guidance.
weblate/trans/guide.py Adds new guideline classes and repo scanning logic to suggest extractors.
weblate/templates/trans/alert/extractpotmissingmsgmerge.html Adds user-facing alert text explaining missing msgmerge for PO updates.
weblate/templates/trans/alert/extractpotaddonerror.html Adds alert template wiring for POT extraction errors.
weblate/addons/tests.py Adds extensive tests for new POT extraction add-ons and edge cases.
weblate/addons/models.py Updates add-on save/delete flows to refresh the new guidance alert where relevant.
weblate/addons/gettext.py Implements the new ExtractPot add-on base and xgettext/Django/Sphinx variants.
weblate/addons/forms.py Adds configuration forms for the new POT extraction add-ons.
weblate/addons/extractors/sphinx/docutils.conf Disables docutils file insertion/raw for safe Sphinx extraction builds.
weblate/addons/extractors/sphinx/conf.py Adds minimal Sphinx config for extraction-only builds.
weblate/addons/extractors/django/settings.py Adds minimal Django settings module for extraction runner.
weblate/addons/extractors/django/run.py Adds runner entrypoint to invoke restricted extraction-only makemessages.
weblate/addons/extractors/django/command.py Adds restricted makemessages command ensuring trusted output paths.
docs/snippets/addons-autogenerated.rst Documents the new add-ons (autogenerated snippet update).
docs/changes.rst Adds changelog entry mentioning the new POT update add-ons.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 22 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@argos-ci
Copy link

argos-ci bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Awaiting the start of a new Argos build…

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 23 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 23 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nijel nijel force-pushed the po-update branch 2 times, most recently from 0cd04c6 to 91996b1 Compare March 27, 2026 14:40
@nijel nijel requested a review from Copilot March 27, 2026 14:40
@nijel nijel marked this pull request as ready for review March 27, 2026 14:40
@nijel nijel requested a review from AliceVisek as a code owner March 27, 2026 14:40
@codecov
Copy link

codecov bot commented Mar 27, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 29 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91996b1473

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 29 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ba43f998a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- currently limited to xgettext, Django and Sphinx
- we have not intention for generic solution here

Fixes WeblateOrg#10708
Fixes WeblateOrg#18428
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 29 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 425 to 427
verbose = gettext_lazy("Could not run add-on.")
doc_page = "adons"
doc_page = "addons"

Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc_page should likely be admin/addons (the docs file is docs/admin/addons.rstadmin/addons.html). Using addons will generate links to .../addons.html, which doesn’t exist, so the documentation icon for these alerts will be broken.

Copilot uses AI. Check for mistakes.
Comment on lines 432 to 434
verbose = gettext_lazy("Could not run add-on.")
doc_page = "adons"
doc_page = "addons"
doc_anchor = "addon-weblate-cdn-cdnjs"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc_page should probably be admin/addons (see docs/admin/addons.rst). With addons here, the generated documentation link will point to a non-existent addons.html page.

Copilot uses AI. Check for mistakes.
Comment on lines 440 to 442
verbose = gettext_lazy("Could not run add-on.")
doc_page = "adons"
doc_page = "addons"
doc_anchor = "addon-weblate-gettext-msgmerge"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc_page should be admin/addons (the add-ons documentation lives under docs/admin/addons.rst). As written, this will generate a link to .../addons.html which doesn’t exist.

Copilot uses AI. Check for mistakes.
Comment on lines +447 to +450
# Translators: Name of an alert
verbose = gettext_lazy("Could not update POT file.")
doc_page = "addons"

Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc_page should likely be admin/addons (docs live at docs/admin/addons.rst). Using addons will produce broken documentation links for this new alert.

Copilot uses AI. Check for mistakes.
Comment on lines +455 to +458
verbose = gettext_lazy("POT updates do not update PO files.")
dismissable = True
doc_page = "addons"
doc_anchor = "addon-weblate-gettext-msgmerge"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc_page should probably be admin/addons (see docs/admin/addons.rst). With addons here, the documentation icon will point to .../addons.html, which is not a valid docs page.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate PO files update Gettext addon: generate/update .pot file

2 participants