Skip to content

Improve search by ignoring accents and use primary language for terms#131

Open
microstudi wants to merge 2 commits intomainio:mainfrom
openpoke:upstream-fix-search
Open

Improve search by ignoring accents and use primary language for terms#131
microstudi wants to merge 2 commits intomainio:mainfrom
openpoke:upstream-fix-search

Conversation

@microstudi
Copy link
Copy Markdown

@microstudi microstudi commented Apr 29, 2026

This addresses the following problems:

  • Translation search now merges locale results with canonical English fallback for broader coverage.
  • Search matching normalizes Unicode (diacritics/accents) and is case-insensitive for more accurate matches.

…#8)

* Improve search by ignoring accents and use primary language for terms

* remove uniq

* address review

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix order of search

* address review

* hardden unicode marks

* better namimg

* cops

* fix backend

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 11:20
@microstudi microstudi changed the title Improve search by ignoring accents and use primary language for terms (#8) Improve search by ignoring accents and use primary language for terms Apr 29, 2026
Copy link
Copy Markdown

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

This PR aims to improve term/translation searching by making term matching accent-insensitive and by preferring primary-language (e.g., English) source terms as a fallback when a locale is missing translations.

Changes:

  • Add Unicode normalization (diacritic/mark stripping) to TranslationStore#by_term matching.
  • Update TranslationDirectory search behavior to merge locale results with primary-language fallback results.
  • Extend specs to cover accent-insensitive search and fallback/merge behavior across locales.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/decidim/term_customizer/translation_store.rb Normalizes strings (NFD + strip Unicode marks) to make term search accent-insensitive.
lib/decidim/term_customizer/translation_directory.rb Refactors search to merge locale and primary-language results (currently incomplete/broken).
spec/lib/decidim/term_customizer/translation_store_spec.rb Adds coverage for accent-insensitive term searches and non-diacritic Unicode mark handling.
spec/lib/decidim/term_customizer/translation_directory_spec.rb Adds scenarios for accent-insensitive searches and primary-language fallback behavior when locale translations are missing/overlapping.

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

Comment thread lib/decidim/term_customizer/translation_directory.rb
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.

2 participants