Skip to content

Fix web semantics language tags for locales with country codes - #195258

Draft
rahulshahDEV wants to merge 1 commit into
flutter:masterfrom
rahulshahDEV:fix/194688-web-locale-language-tag
Draft

rahulshahDEV wants to merge 1 commit into
flutter:masterfrom
rahulshahDEV:fix/194688-web-locale-language-tag

Conversation

@rahulshahDEV

@rahulshahDEV rahulshahDEV commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

Use Locale.toLanguageTag() when writing the web semantics lang attribute. A locale constructed as Locale('es', 'US') now produces the BCP 47 tag es-US instead of es_US, allowing browsers and assistive technology to recognize the language correctly.

Fixes #194688

Verification

  • The regression test fails with the old implementation: expected es-US, actual es_US.
  • Focused Chrome web semantics suite: all 189 tests passed.
  • Targeted dart analyze: no issues found.
  • dart format --set-exit-if-changed and git diff --check passed.

Contributor review completed on 2026-10-26, and independent spec and standards reviews found no actionable findings. The PR remains a draft because GitHub denied the ready-for-review state change.

Pre-launch Checklist

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically team-web Owned by Web platform team labels Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web] Semantics lang attribute uses Locale.toString(), producing invalid tags like es_US

1 participant