Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no plural rule registered for XX #231

Open
bep opened this issue Oct 8, 2020 · 4 comments
Open

no plural rule registered for XX #231

bep opened this issue Oct 8, 2020 · 4 comments

Comments

@bep
Copy link
Contributor

bep commented Oct 8, 2020

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

@bep
Copy link
Contributor Author

bep commented Oct 8, 2020

I could proably check the error and try again.

@nicksnyder
Copy link
Owner

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.

@bep
Copy link
Contributor Author

bep commented Oct 9, 2020

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.

@nicksnyder
Copy link
Owner

nicksnyder commented Oct 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants