Skip to content

feat(ui): sort editor languages using Collator locale rules - #43

Merged
unknowIfGuestInDream merged 2 commits into
masterfrom
copilot/sort-languages-using-locale-rules
May 15, 2026
Merged

unknowIfGuestInDream merged 2 commits into
masterfrom
copilot/sort-languages-using-locale-rules

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown

Languages in the right-hand editor panel were displayed in disk-load order rather than any meaningful alphabetical order. This ports upstream essiembre/eclipse-rbe#54 to apply java.text.Collator-based locale-aware sorting.

Changes

  • UIUtils — two additions:

    • LocaleComparator: a Comparator<Locale> using Collator.getInstance() at PRIMARY strength, so sorting respects the Eclipse instance's locale rules (accents, umlauts, etc.). null (default bundle) always sorts first. Collator is initialised once per instance, not per comparison.
    • sortLocales(Collection<Locale>): convenience method returning a new sorted List<Locale> via LocaleComparator.
  • I18nPage.createEditingPart() — iterates over UIUtils.sortLocales(resourceMediator.getLocales()) instead of the raw unsorted list, so right-hand editor panels always render in locale-aware order.

  • ResourceFactory — replaces the bespoke inline TreeMap comparator (plain compareToIgnoreCase) with new UIUtils.LocaleComparator(), consolidating all locale comparison logic and applying consistent Collator-based ordering throughout.

// Before: plain case-insensitive string compare in ResourceFactory
new TreeMap<>(new Comparator<Locale>() {
    public int compare(Locale l1, Locale l2) {
        return UIUtils.getDisplayName(l1).compareToIgnoreCase(UIUtils.getDisplayName(l2));
    }
});

// After: Collator-backed, null-safe, locale-aware
new TreeMap<>(new UIUtils.LocaleComparator());

Port of upstream essiembre#54 (fixes #53).

- Add UIUtils.LocaleComparator: uses java.text.Collator (PRIMARY
  strength) so sorting respects the locale rules of the running
  Eclipse instance; null (default locale) always sorts first.
- Add UIUtils.sortLocales(): sorts a Collection<Locale> into a
  new List using LocaleComparator.
- I18nPage.createEditingPart(): iterate over sortLocales() so the
  right-hand side panels appear in locale-aware alphabetical order.
- ResourceFactory: replace inline case-insensitive comparator with
  UIUtils.LocaleComparator, removing the now-redundant code.

Agent-Logs-Url: https://github.com/tlcsdm/eclipse-rbe/sessions/57f54e15-edc5-40ea-819b-8a56136ef2b3

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature to sort languages using Locale rules feat(ui): sort editor languages using Collator locale rules May 15, 2026
@unknowIfGuestInDream
unknowIfGuestInDream merged commit 4377601 into master May 15, 2026
18 checks passed
@unknowIfGuestInDream
unknowIfGuestInDream deleted the copilot/sort-languages-using-locale-rules branch May 15, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Sort languages in the right-hand side of the editor using Locale rules of the eclipse instance

2 participants