expected: "3 minuttar lesing",
expectedFlag: "3 minuttar lesing",
},
+ // https://github.com/gohugoio/hugo/issues/7798
+ {
+ name: "known-language-missing-plural",
+ data: map[string][]byte{
+ "oc.toml": []byte(`[oc]
+one = "abc"`),
+ },
+ args: 1,
+ lang: "oc",
+ id: "oc",
+ expected: "abc",
+ expectedFlag: "abc",
+ },
// https://github.com/gohugoio/hugo/issues/7794
{
name: "dotted-bare-key",
} else {
expected = test.expected
}
- actual = doTestI18nTranslate(t, test, v)
+ actual = doTestI18nTranslate(c, test, v)
c.Assert(actual, qt.Equals, expected)
})
}
import (
"encoding/json"
+ "strings"
"github.com/gohugoio/hugo/common/herrors"
"golang.org/x/text/language"
_, err = bundle.ParseMessageFileBytes(b, name)
if err != nil {
+ if strings.Contains(err.Error(), "no plural rule") {
+ // https://github.com/gohugoio/hugo/issues/7798
+ name = artificialLangTagPrefix + name
+ _, err = bundle.ParseMessageFileBytes(b, name)
+ if err == nil {
+ return nil
+ }
+ }
return errWithFileContext(_errors.Wrapf(err, "failed to load translations"), r)
}