Open pickfire opened 1 year ago
Do you know a crate that validates language code for the browser?
Both tags are valid, for a static site generator it might be useful to suggest adding a script to certain language codes.
Let me investigate on this, I think I need to check what needs to be done and if needed probably a separate crate will be done.
Looks like the crate language-tags
does exactly what is needed here.
Another crate seemingly doing exactly what is needed here is fluent-langneg
, also given that zola might use Fluent in future.
fluent-langneg sounds like a good solution
Bug Report
Environment
Zola version: 0.17.2
Expected Behavior
zh-CN
should not be valid language and should be suggested to usezh-Hans-CN
orzh-Hans
instead. I have seenzh-CN
quite often in quite a few sites since it renders differently if it is done incorrectly and less readable.Current Behavior
zh-CN
passed language validation check since it usesunic-langid
but is not recognized by browser, it should instead usezh-Hans
which is specified by https://datatracker.ietf.org/doc/html/rfc5646#appendix-A and https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang.I filled an issue to hexo too https://github.com/hexojs/hexo/issues/5186.
Step to reproduce
default_language = "zh-CN"
inconfig.toml
.