When developing multilingual websites, understanding language codes like zh-CN, zh-TW, zh-Hans, and zh-Hant is crucial for proper localization. These codes help browsers and servers communicate preferred language settings, ensuring users receive content in their desired language variant.
How Browser Language Preferences Work
When you visit a webpage, your browser sends an accept-language header to the web server. This header contains your language preferences in a prioritized format, such as:
zh-CN,zh;q=0.9,en;q=0.8,fr;q=0.7,pt;q=0.6,so;q=0.5,de;q=0.4,en-US;q=0.3,ko;q=0.2,ja;q=0.1,zh-TW;q=0.1,und;q=0.1Different platforms may use various language code formats for Chinese content:
Key Chinese Language Variants Explained
1. Simplified Chinese Codes
zh-CN:
- Represents Simplified Chinese used in Mainland China
- Uses simplified character set
- Most widely supported format
zh-Hans:
- Also represents Simplified Chinese
- Follows ISO 639-3 language standard ("Hans" = "Han Simplified")
- Less broadly supported (mainly Windows 10 and Edge browser)
2. Traditional Chinese Codes
zh-TW:
- Represents Traditional Chinese used in Taiwan
- Uses traditional character set
- Standard format for Taiwanese content
zh-Hant:
- Also represents Traditional Chinese
- ISO 639-3 standard ("Hant" = "Han Traditional")
- Alternative format with growing adoption
Implementation Best Practices
Browser/OS Support Considerations
- Most systems and browsers use
zh,zh-CNfor Simplified Chinese - Traditional Chinese typically uses
zh-TW zh-Hans/zh-Hantsupport currently limited to newer Microsoft products
HTML Language Tagging
- Single-language sites: Use
lang="zh" Multilingual sites:
- Simplified Chinese:
lang="zh-CN" - Traditional Chinese:
lang="zh-TW"
- Simplified Chinese:
๐ Learn more about multilingual SEO best practices
FAQ Section
Q: Which language code should I use for Mainland Chinese users?
A: zh-CN is the most reliable choice with widest compatibility.
Q: Are zh-Hans and zh-CN interchangeable?
A: While similar, zh-CN has broader support. Use zh-Hans only when specifically targeting newer Microsoft platforms.
Q: How does Google treat these language variants?
A: Google recognizes all formats but prioritizes zh-CN/zh-TW for search results unless zh-Hans/zh-Hant are explicitly declared.
Q: Should I use zh or zh-CN for Simplified Chinese?
A: For precise targeting, zh-CN is preferable. The generic zh works but lacks regional specificity.
๐ Discover advanced localization strategies
By understanding these language code nuances, developers can create more effective multilingual experiences that properly serve both Simplified and Traditional Chinese audiences.