Open nyurik opened 4 years ago
I fixed a similar issue in https://phabricator.wikimedia.org/T228510
The standard language code for zh-classical
is lzh
.
@Nikerabbit thanks, but the banana lib has an entry for it in https://github.com/wikimedia/banana-i18n/blob/6fc921139f42d39092a09964de55dc116232003e/src/languages/fallbacks.json#L156 -- shouldn't it automatically handle such things internally? If banana lib is targeting Wikipedia, it should IMO handle every "language-like" prefix Wikipedia has -- i.e. *.wikipedia.org
I recommend against using the domain code as language code. There are many exceptions where they do not match. The real language code (queryable via API, mw.config.values.wgContentLanguage, etc.) is better.
@Nikerabbit you assume the code runs in MW, whereas I use it outside of it -- https://dibabel.toolforge.org/ -- and I would have to resolve the domain into the default language. That said, could you explain why there is a fallback file? If its there, I would assume it is supported. Otherwise its a bug to have stuff in it that doesn't work :)
P.S. I just double checked -- https://meta.wikimedia.org/w/api.php?action=sitematrix&formatversion=2 -- zh-classical
is the official language code:
"313": {
"code": "zh-classical",
"name": "文言",
"site": [
{
"url": "https://zh-classical.wikipedia.org",
"dbname": "zh_classicalwiki",
"code": "wiki",
"sitename": "維基大典"
}
],
"dir": "ltr",
"localname": "Classical Chinese"
},
This is necro-posting, but that's the sitecode, not language code. Going to https://zh-classical.wikipedia.org and hitting mw.config.get('wgContentLanguage')
gives lzh
.
This code crashes because it calls
new Intl.PluralRules("zh-classical")
, which is an error in Chrome.Error: