Language Tag (BCP 47)
A standardized code format for identifying languages and locales (e.g., en-US, zh-Hans-CN).
Definition
Language tags following BCP 47 (IETF Best Current Practice 47) are standardized identifiers for languages, scripts, and regions. The format is: language[-script][-region][-variant]. Examples: 'en' (English), 'en-US' (English, US), 'zh-Hans-CN' (Chinese, Simplified script, China). These tags are used in HTTP Accept-Language headers, HTML lang attributes, and i18n libraries.
Examples
- →en - English (language only)
- →en-US - English, United States (language + region)
- →zh-Hans - Chinese, Simplified script (language + script)
- →zh-Hans-CN - Chinese, Simplified, China (full tag)
Frequently Asked Questions
What's the difference between ISO 639-1 and BCP 47?
ISO 639-1 defines 2-letter language codes (en, es, de). BCP 47 extends this with optional script (Hans, Latn) and region (US, GB) subtags. BCP 47 is the standard for web and software—use it for full locale identification.
Should I use en-US or en_US format?
BCP 47 uses hyphen: en-US. Some systems use underscore: en_US (POSIX convention). Web standards (HTML, HTTP) use hyphen. Most i18n libraries accept both but normalize internally. Be consistent within your project.