feat: better flag interface#19716
Merged
Merged
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
The latest updates on your projects. Learn more about Argos notifications ↗︎ Awaiting the start of a new Argos build… |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
35f95af to
b79bed1
Compare
for more information, see https://pre-commit.ci
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new tag-based UI for editing translation flag fields (autocomplete + grouped suggestions), backed by a new JSON endpoint that exposes the known flag catalog (localized by language).
Changes:
- Added
/js/flags/endpoint returning a localized catalog of known translation flags. - Replaced flag text inputs with a TomSelect-based tag editor (including accessibility tweaks for label association).
- Added/updated tests (Django JS view tests + Selenium adjustment) and documented the user-visible change.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| weblate/urls.py | Adds routing for the new js-flag-choices endpoint. |
| weblate/trans/views/js.py | Implements the JSON endpoint returning localized flag choices. |
| weblate/trans/forms.py | Introduces FlagEditorWidget/FlagField to attach the new UI and embed the endpoint URL. |
| weblate/templates/base.html | Loads the new flag-editor.js globally. |
| weblate/static/js/flag-editor.js | Implements the TomSelect tag editor UI and loads/caches flag choice data. |
| weblate/static/styles/main.css | Tweaks TomSelect “create” entry styling. |
| weblate/trans/tests/test_js_views.py | Adds coverage for the new endpoint (including lang handling + cache header). |
| weblate/trans/tests/test_selenium.py | Updates selector to target the TomSelect input id. |
| weblate/checks/flags.py | Adds categorized, localized get_flag_choices() with per-language caching. |
| weblate/checks/tests/test_flags.py | Adds tests for get_flag_choices() and per-language caching behavior. |
| docs/changes.rst | Documents the new flag editor UX change for the release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Looks great, thanks! Please check the Copilot feedback (at least the parser difference looks valid to me). |
for more information, see https://pre-commit.ci
Member
|
Merged, thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a selector for flags with autocomplete/search and categorization:

Includes backend endpoint for returning the flag catalog that is used by the frontend to populate the selection.
TODOs:
Closes #1567