{"record":{"id":"97ad33ab14ff66f2","repo":"kataras/iris","slug":"key-q-no-registered-plurals-for-d","errorCode":null,"errorMessage":"key: %q: no registered plurals for <%d>","messagePattern":"key: %q: no registered plurals for <(.+?)>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"i18n/internal/message.go","lineNumber":73,"sourceCode":"\n// Render completes the Renderer interface.\n// It accepts arguments, which can resolve the pluralization type of the message\n// and its variables. If the Message is wrapped by a Template then the\n// first argument should be a map. The map key resolves to the pluralization\n// of the message is the \"PluralCount\". And for variables the user\n// should set a message key which looks like: %VAR_NAME%Count, e.g. \"DogsCount\"\n// to set plural count for the \"Dogs\" variable, case-sensitive.\nfunc (m *Message) Render(args ...any) (string, error) {\n\tif m.Plural {\n\t\tif len(args) > 0 {\n\t\t\tif pluralCount, ok := findPluralCount(args[0]); ok {\n\t\t\t\tfor _, plural := range m.Plurals {\n\t\t\t\t\tif plural.Form.MatchPlural(pluralCount) {\n\t\t\t\t\t\treturn plural.Renderer.Render(args...)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn \"\", fmt.Errorf(\"key: %q: no registered plurals for <%d>\", m.Key, pluralCount)\n\t\t\t}\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"key: %q: missing plural count argument\", m.Key)\n\t}\n\n\treturn m.Locale.Printer.Sprintf(m.Key, args...), nil\n}\n","sourceCodeStart":55,"sourceCodeEnd":82,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/i18n/internal/message.go#L55-L82","documentation":"When rendering a plural Message, the library finds the plural count from the first argument and searches m.Plurals for a registered PluralForm whose rules match that count. If none matches, Render returns \"key: %q: no registered plurals for <%d>\". This means the count is valid but no plural form was registered that covers it.","triggerScenarios":"Calling Render/T with a plural key and a numeric count (e.g. 0, 2, 100) for which no PluralForm was registered — e.g. only \"one\" and \"other\" forms were defined but the language requires \"few\"/\"many\" (Russian, Arabic) or the count falls outside registered ranges.","commonSituations":"Incomplete translation files missing plural cases for a language, counts like 0 or 2 hitting unregistered forms in Slavic/Arabic locales, or custom PluralFormDecoder mismatching the registered forms.","solutions":["Register the missing plural form(s) for the key — ensure \"other\" is always defined as a fallback.","Verify the language's CLDR plural categories and add all required forms (e.g. few/many for ru, zero/one/two/few/many for ar).","Check findPluralCount behavior: pass the count as the first Render argument as a plain number.","Provide a DefaultMessageFunc to fall back to the default language message when a form is missing."],"exampleFix":"// before (en-US style forms on ru locale)\n\"apples\": \"one:%d яблоко|other:%d яблок\"\n// after\n\"apples\": \"one:%d яблоко|few:%d яблока|many:%d яблок|other:%d яблока\"","handlingStrategy":"fallback","validationCode":"// ensure counts you will render are covered\nfor _, n := range []int{0, 1, 2, 5, 100, 1000} {\n    if _, err := msg.Render(n); err != nil {\n        log.Printf(\"key %s uncovered for count %d: %v\", key, n, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"s, err := tr.Render(n)\nif err != nil && strings.Contains(err.Error(), \"no registered plurals\") {\n    s, err = tr.Render(1) // fallback to a covered form\n}","preventionTips":["Always define the \"other\" plural form as a catch-all.","For Slavic/Arabic locales, register all CLDR forms (few, many, zero...).","Smoke-test rendering with edge counts (0, 1, 2, large numbers).","Use DefaultMessageFunc to fall back to default language messages."],"tags":["i18n","go","plural","cldr"],"backgroundTag":"missing-plural-form","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}