Invalid lang tags on "underlined" locales

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 https://www.iana.org/assignments/lang-tags/zh-Hans-CN. Missing that doesn’t break too many things though.

3 Likes

https://github.com/discourse/discourse/commit/cc851af7500b7a9cfb383eca731591d2229d5b36

4 Likes