UnixEpoch

区域标识转换器

在 BCP 47、POSIX、ICU 和 Accept-Language 之间转换区域标识,并预览浏览器 Intl 格式。

Paste a locale tag, POSIX locale string, or Accept-Language header.

Common Locale Conversion 示例

Input en_US.UTF-8 Output en-US

Common POSIX locale from shell environments and Linux servers.

Input zh_Hans_CN Output zh-Hans-CN

ICU-style locale with explicit script and region.

Input sr_RS@latin Output sr-Latn-RS

POSIX modifier converted into a script subtag.

Input Accept-Language: fr-CA,fr;q=0.9 Output fr-CA

Browser header reduced to the primary requested locale.

如何使用此工具

  1. Enter a locale tag, POSIX locale string, or Accept-Language header from your app, browser, or server logs.
  2. Check the canonical BCP 47 locale, POSIX form, HTML lang value, and Accept-Language fallback chain.
  3. Use the preview cards to confirm how Intl resolves dates, numbers, relative time, and sorting for that locale.

本页解答内容

  • How do I convert en_US.UTF-8 into a browser locale tag?
  • What locale should I put in an HTML lang attribute or Intl API call?
  • How does an Accept-Language header map to a primary requested locale?
  • Which locale does the browser actually resolve for numbers, dates, and sorting?

常见问题

What does this locale converter normalize?

It normalizes common locale inputs such as en_US.UTF-8, zh_Hans_CN, sr_RS@latin, and Accept-Language headers into cleaner locale formats for browser and application use.

What is the difference between BCP 47 and POSIX locale formats?

BCP 47 uses dash-separated tags like en-US for web and Intl APIs, while POSIX locale strings often use underscores and charsets such as en_US.UTF-8 for servers and shell environments.

Can I parse an Accept-Language header here?

Yes. Paste a full header such as Accept-Language: fr-CA,fr;q=0.9 and the tool extracts the primary locale and shows a fallback chain.

Why do resolved locales differ from the requested locale?

Browser Intl APIs can fall back to a supported parent locale or canonical variant. The resolved locale cards show what NumberFormat, DateTimeFormat, ListFormat, RelativeTimeFormat, and Collator actually use.

Is this locale converter online only or does it call a server API?

The parsing and preview logic run in the browser, so you can inspect locale behavior instantly without sending the locale input to a conversion API.

刷新或再次打开时,网站会记住我上次输入的内容和设置吗?

会。你输入的时间戳、日期、单位选择等各项内容——例如转换数值、时区、日期格式、倒计时目标——只保存在你自己设备的浏览器本地存储里,刷新页面或稍后再来都能立即恢复上次的配置,不必每次重新输入;无需注册账号,内容不会上传,也不在任何服务器上留存,换一台设备或换一个浏览器互不影响。清空某个输入框,对应内容即从记忆中删除,把所有输入清空就等于彻底遗忘。被记住的只有纯输入与设置项,随时可以修改或清除。

相关工具

参考与资源

区域感知格式化由 BCP 47 语言标签和 Unicode CLDR 数据集进行标准化,然后通过 JavaScript Intl API 提供给 Web 使用。这些资料定义了日期、数字和日历在不同区域设置下的差异。