# Invalid lang tags on "underlined" locales

**URL:** https://meta.discourse.org/t/invalid-lang-tags-on-underlined-locales/94954
**Category:** Bug
**Created:** [August 17, 2018, 2:14am UTC](https://meta.discourse.org/t/invalid-lang-tags-on-underlined-locales/94954 "2018-08-17T02:14:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Artoria2e5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/artoria2e5/32/109009_2.png) [@Artoria2e5](https://meta.discourse.org/u/Artoria2e5)
#### Post date: [August 17, 2018, 2:14am UTC](https://meta.discourse.org/t/invalid-lang-tags-on-underlined-locales/94954/1 "2018-08-17T02:14:36Z")

</div>

Locales like zh\_CN and zh\_TW seems to simply copy to the root-level HTML `lang` attribute, causing malformed values with underlines in it. The practical downside to it is that the CSS `:lang(zh)` selector simply won’t work, as it expects locale names with hyphens (`-`) instead of underlines (`_`). Can someone just make a fix to force-reformat the `lang` attribute to have hyphens instead of underlines?

* * *

For zh\_CN and zh\_TW specifically, there are some additional locale name changes required per [Language Tag Registration Form Archive (OBSOLETE)](https://www.iana.org/assignments/lang-tags/zh-Hans-CN). Missing that doesn’t break too many things though.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [August 20, 2018, 11:58am UTC](https://meta.discourse.org/t/invalid-lang-tags-on-underlined-locales/94954/3 "2018-08-20T11:58:47Z")

</div>

[FIX: HTML lang attribute expects hyphen instead of underscore · discourse/discourse@cc851af · GitHub](https://github.com/discourse/discourse/commit/cc851af7500b7a9cfb383eca731591d2229d5b36)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [August 20, 2018, 11:58am UTC](https://meta.discourse.org/t/invalid-lang-tags-on-underlined-locales/94954/4 "2018-08-20T11:58:54Z")

</div>


