Skip to content

Pass user locale to localeCompare so sorts honor the selected language#9190

Closed
kevinortiz43 wants to merge 1 commit into
developfrom
web/bugfix/localecompare-honor-locale
Closed

Pass user locale to localeCompare so sorts honor the selected language#9190
kevinortiz43 wants to merge 1 commit into
developfrom
web/bugfix/localecompare-honor-locale

Conversation

@kevinortiz43

@kevinortiz43 kevinortiz43 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

localeCompare with no locale argument used the runtime default, mis-collating sorted lists (community names, chat members, profile tags, language picker) for non-English users. Pass useTranslation's i18n.language wherever it's available. CommunitySearch sorts via useMemo so it re-sorts on locale change without refetching.

Fixes #8817.

Testing

  • yarn format (prettier + eslint) clean — no warnings.
  • tsc --noEmit clean.
  • Jest: CommunitySearch 8/8, translate/utils (incl. getAvailableLanguages) 16/16, LanguagePickerSelect 6/6 — pass. No new tests added (the affected sorts are inline; existing suites cover ordering and i18n.language is "en" in tests).
  • Playwright (online, logged in), desktop (1280px) + mobile (390px): switched locale en → de → es → en — nav strings, NEXT_LOCALE cookie, /de/ URL prefix, and <html lang> all update correctly. Verified the ProfileTagInput language list is sorted under de collation, and the LanguagePickerSelect / CommunitySearch lists render with no console errors.

Web frontend checklist

  • There are no console warnings when running the app
  • Added tests where relevant
  • Clicked around my changes running locally and it works
  • Checked Desktop, Mobile and Tablet screen sizes

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

localeCompare with no locale used the runtime default, mis-collating sorted
lists (community names, chat members, profile tags, language picker) for
non-English users. Pass useTranslation's i18n.language wherever available.
CommunitySearch sorts via useMemo so it re-sorts on locale change without
refetching. Fixes #8817.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kevinortiz43
kevinortiz43 requested a review from nabramow as a code owner June 27, 2026 17:15
@kevinortiz43
kevinortiz43 requested review from nabramow and tristanlabelle and removed request for nabramow June 27, 2026 17:15
@CouchersBot

CouchersBot commented Jun 27, 2026

Copy link
Copy Markdown
Member

@kevinortiz43

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #9128, which already tracks issue #8817. Consolidating there.

@kevinortiz43
kevinortiz43 deleted the web/bugfix/localecompare-honor-locale branch June 27, 2026 17:30
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.

Uses of localeCompare don't honor the user-selected locale

2 participants