no plural rule registered for XX
I got an error report in Hugo:
no plural rule registered for oc
I was pretty sure I had a test for that, and I did.
What I currently do is something like this:
lang := "oc"
tag := language.Make(lang)
if tag == language.Und {
name = "art-x-" + name
}
_, _ = bundle.ParseMessageFileBytes(b, name)
The above works fine for klingon, but not for oc (which is a valid language code).
I assume this is a data synch issue, but I don't know how to work around it.
/cc @digitalcraftsman
I could proably check the error and try again.
The latest CLDR data (v37) does not include a plural rule for oc.
Using art-x-oc should work. I verified this test still passes if I substitute art-x-oc for art-x-klingon.
Using art-x-oc should work.
Sure, but having to do a "check if error string contains this magic string" and then do a retry isn't ... perfect.
Currently for a locale to work with go-i18n, it must either:
- Be supported by both https://pkg.go.dev/golang.org/x/text and have a plural rule defined in CLDR OR
- Be an artificial language (e.g.
art-x-prefix) (in which case it would use default pluralization rules, which might not be what is desired).
The real solution to this problem for a given locale is to submit an upstream change to add support for that new locale.