fix: explicit country code handling for client-side localization #19841
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.
Changes -
Backend (fxa-shared)
Locale-Agnostic ClientFormatter
ClientFormatter.ts: Removed CLDR dependency and server-side localization logic.
formatLocation
now returns the canonical countryCode (from the existing
Location
type) and the raw country string.
No changes to
AttachedClient.ts
.
Frontend (fxa-settings)
Client-Side Localization
types.ts
: Added countryCode to
RemoteMetadata
.
DeviceInfoBlock
: uses Intl.DisplayNames to localize the country name based on the user's current locale, falling back to the raw name.
Tests
Updated
fxa-shared/test/connected-services/formatters.ts
to assert countryCode presence and verify that country strings are passed through without server-side localization.
Closes: (#18859)
Checklist:
[x] My commit is GPG signed.
Logic: Static analysis confirms the data flow:
Geodb->Location(with countryCode) ->ClientFormatter(passes countryCode) ->API->Frontend->Intl->UI.API Contract: The backend now strictly follows the "canonical identifier" contract.
Build: Local build was skipped due to environment issues, but the code changes are now stripped of any risky type redefinitions.