Add country-qualifier dedup to language switcher#555
Merged
Conversation
When only one dialect of a base language is enabled, the switcher
now renders the bare language name ("German", "Chinese") instead
of the configured "German (Germany)" / "Chinese (Simplified)".
Multi-dialect bases (e.g. en-US + en-GB) keep the qualifier so
entries remain distinguishable. Restores the bare-label rendering
lost in d1c2d57 when the switcher rewrote to one-row-per-dialect.
Implementation lives in PhoenixKitWeb.Components.Core.LanguageSwitcher
(the frontend switcher) as the canonical home — `dedupe_names/1` is
public and called from AdminNav and UserDashboardNav so all language
menus share one rule. Bare-name derivation reuses the historical
`extract_base_language_name/1` string parse
("Spanish (Mexico)" -> "Spanish"); sibling count comes from
`DialectMapper.group_dialects_by_base/1`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon
pushed a commit
that referenced
this pull request
May 20, 2026
#554 ships the PR #552 locale-prefix follow-ups (login-redirect gate, LocalePath dedup, redirect_invalid_locale swap-vs-strip, 22 new tests). Verdict: ship. Notes are nitpicks — double prefixless_primary? read in redirect_invalid_locale, moduledoc "three rules" / four-item list, mix_task_context? sentinel duplicated between Languages + Routes. #555 restores the bare-label rendering for single-dialect bases in the language switcher (and inherits it into admin/user dashboard nav via the public dedupe_names/1). Verdict: ship. Notes are nitpicks — unrun doctests on the new helpers, the dedup rule is duplicated between display_name_for/3 and dedupe_one_name/2, extract_base_language_name/1 returns "" on "" input. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ddon
pushed a commit
that referenced
this pull request
May 20, 2026
Rolls up PR #554 (locale-prefix follow-ups — login regression fix, sitemap source dedup, redirect_invalid_locale swap-vs-strip, 22 new tests), PR #555 (language switcher country-qualifier dedup), and the etcher 0.3 → 0.4 / fresco 0.5.2 → 0.5.3 bumps. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
When only one dialect of a base language is enabled, the switcher now renders the bare language name ("German", "Chinese") instead of the configured "German (Germany)" / "Chinese (Simplified)". Multi-dialect bases (e.g. en-US + en-GB) keep the qualifier so entries remain distinguishable. Restores the bare-label rendering lost in d1c2d57 when the switcher rewrote to one-row-per-dialect.
Implementation lives in PhoenixKitWeb.Components.Core.LanguageSwitcher (the frontend switcher) as the canonical home —
dedupe_names/1is public and called from AdminNav and UserDashboardNav so all language menus share one rule. Bare-name derivation reuses the historicalextract_base_language_name/1string parse("Spanish (Mexico)" -> "Spanish"); sibling count comes from
DialectMapper.group_dialects_by_base/1.