feat(add-ons): add pot update support#18672
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎ Awaiting the start of a new Argos build… |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
0cd04c6 to
91996b1
Compare
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
💡 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
There was a problem hiding this comment.
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.
| verbose = gettext_lazy("Could not run add-on.") | ||
| doc_page = "adons" | ||
| doc_page = "addons" | ||
|
|
There was a problem hiding this comment.
doc_page should likely be admin/addons (the docs file is docs/admin/addons.rst → admin/addons.html). Using addons will generate links to .../addons.html, which doesn’t exist, so the documentation icon for these alerts will be broken.
| verbose = gettext_lazy("Could not run add-on.") | ||
| doc_page = "adons" | ||
| doc_page = "addons" | ||
| doc_anchor = "addon-weblate-cdn-cdnjs" |
There was a problem hiding this comment.
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.
| verbose = gettext_lazy("Could not run add-on.") | ||
| doc_page = "adons" | ||
| doc_page = "addons" | ||
| doc_anchor = "addon-weblate-gettext-msgmerge" |
There was a problem hiding this comment.
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.
| # Translators: Name of an alert | ||
| verbose = gettext_lazy("Could not update POT file.") | ||
| doc_page = "addons" | ||
|
|
There was a problem hiding this comment.
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.
| verbose = gettext_lazy("POT updates do not update PO files.") | ||
| dismissable = True | ||
| doc_page = "addons" | ||
| doc_anchor = "addon-weblate-gettext-msgmerge" |
There was a problem hiding this comment.
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.
Fixes #10708
Fixes #18428