Skip to content

Request to Support RFC 5646 (BCP 47) Format for Localized Property #324

@willysoft

Description

@willysoft

Is there an existing issue for this?

  • I have searched the existing issues

Describe the problem to be solved

Currently, the Localized property only supports ISO 639-1 format, which limits the ability to support different language regions (e.g., zh-TW and zh-CN) simultaneously. Navigator.language returns values in the RFC 5646 (BCP 47) format, which allows more specific language and regional tags. This discrepancy prevents a flexible localization setup that can support multiple variants of the same language, such as zh-TW (Traditional Chinese) and zh-CN (Simplified Chinese), which is important for applications targeting users in both Taiwan and Mainland China.

Suggest a solution

It would be great to extend the Localized property to support RFC 5646 (BCP 47) format, allowing it to handle language tags like zh-TW, zh-CN, and others that specify both language and region. This would enable better compatibility with modern browser behavior and allow localization to be more precise.

Additional context

  • Navigator.language and most modern web APIs return language tags in RFC 5646 format, which is more flexible than the ISO 639-1 standard.
  • Supporting RFC 5646 would also allow applications to serve different content based on both language and regional preferences, ensuring a more tailored user experience.

Key Code Section
The relevant code is located in ./l10n/l10n.js, which handles localization settings and language properties. Adjusting this logic to support RFC 5646 (BCP 47) format should allow multiple language variants to be used simultaneously.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions