Issue:
- There are always only zh-hans.json , zh-hant.json , zh-hk.json (with only language variant name messages in zh.json )
- Currently, MediaWiki JSON messages took precedence over local customized messages in the language fallback chain
- Which means, to override messages in zh-hans.json , we need to duplicate ALL language messages falls back to zh-hans
- This makes custom system messages hard for maintenance
- We should able to override zh-hans.json messages simply by ONLY creating /zh-hans instead of create all of /zh-hans , /zh-cn , /zh-sg , /zh-my
Solution:
- Split out "JSON fallback" and "MediaWiki: fallback"
- For example: The fallback for "/zh-mo" pages / messages if the site language code is zh:
"/zh-mo" (no longer need to be duplicated) => "zh-mo.json" (always not existed) => "/zh-hk" (no longer always need to be duplicated) => "zh-hk.json" (should just fallback to here if string translated separately) => "/zh-hant" (should just fallback to here if defined) => "zh-hant.json" => "(root MediaWiki: page)" ("/zh" pages are not used for backend) => "zh.json" => "/zh-hans" => "zh-hans.json" => "/en" => "en.json" => "qqx"
Checklist:
- Gerrit change for the solution: https://gerrit.wikimedia.org/r/924137
- Patch Demo tests and demonstrations: https://patchdemo.wmflabs.org/wikis/1208833be0/wiki/
- Performance review
- Message / Localisation cache initial build & rebuild (time & memory increments)
- Server cache size increments
- Possible side effects
zh-my, zh-sg, zh-mo, zh-tw, zh-cn, zh are no longer maintained as an interface language variant, thanks to the fallback scheme. currently maintained ones are: zh-hant zh-hans and zh-hk. It should be stressed although these are disabled, the existing have not been removed from the system, which cause maintenance overhead to downstream administrators. Suppose a system message have all the legacy variants set in mediawiki software, it means the interface administrator of a site need to create all the 8ish pages for a single message, which fallback to default mediawiki message instead of its fallback message on local instance.
So if MSG/zh-my and its identical MSG/zh-hans exist in mediawiki software, and the MSG/zh-hans is updated to use some templates maybe. MSG/zh-my needs to be created as well, otherwise it fallback to system message.
After further digging, it seems the problem exist because the read order seems to be MW:MSG/zh-sg, SYS:MSG/zh-sg, SYS:MSG/zh-hans, MW:MSG/zh-hans.
I would propose something like MW:MSG/zh-sg, SYS:MSG/zh-sg; MW:MSG/zh-hans; SYS:MSG/zh-hans. where SYS denotes default in config file, and MW denotes messages created locally in db.