Skip to content

feat: better flag interface#19716

Merged
nijel merged 23 commits into
WeblateOrg:mainfrom
KarenKonou:feat-better-flag-interface
Jun 11, 2026
Merged

feat: better flag interface#19716
nijel merged 23 commits into
WeblateOrg:mainfrom
KarenKonou:feat-better-flag-interface

Conversation

@KarenKonou

@KarenKonou KarenKonou commented May 25, 2026

Copy link
Copy Markdown
Member

Adds a selector for flags with autocomplete/search and categorization:
image
Includes backend endpoint for returning the flag catalog that is used by the frontend to populate the selection.

TODOs:

  • Improve UX
  • Improve accessibility

Closes #1567

@KarenKonou KarenKonou changed the title Feat better flag interface feat: better flag interface May 25, 2026
@KarenKonou KarenKonou changed the title feat: better flag interface WIP: feat: better flag interface May 25, 2026
@argos-ci

argos-ci Bot commented May 27, 2026

Copy link
Copy Markdown

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

Awaiting the start of a new Argos build…

@KarenKonou KarenKonou force-pushed the feat-better-flag-interface branch from 35f95af to b79bed1 Compare June 8, 2026 12:16
@KarenKonou KarenKonou marked this pull request as ready for review June 8, 2026 12:20
@KarenKonou KarenKonou requested a review from nijel as a code owner June 8, 2026 12:20
@KarenKonou KarenKonou changed the title WIP: feat: better flag interface feat: better flag interface Jun 8, 2026
@nijel nijel self-assigned this Jun 11, 2026
@nijel nijel added this to the 2026.7 milestone Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread weblate/static/js/flag-editor.js Outdated
Comment thread weblate/static/js/flag-editor.js Outdated
@nijel

nijel commented Jun 11, 2026

Copy link
Copy Markdown
Member

Looks great, thanks! Please check the Copilot feedback (at least the parser difference looks valid to me).

@nijel nijel merged commit 19cb5b8 into WeblateOrg:main Jun 11, 2026
27 of 31 checks passed
@nijel

nijel commented Jun 11, 2026

Copy link
Copy Markdown
Member

Merged, thanks for your contribution!

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.

Better interface for editing flags

3 participants