{"record":{"id":"952ac856b94377c1","repo":"OrchardCMS/OrchardCore","slug":"plural-form-pluralform-doesn-t-exist-for-the-key-key-in-the","errorCode":null,"errorMessage":"Plural form '{pluralForm}' doesn't exist for the key '{key}' in the '{CultureName}' culture.","messagePattern":"Plural form '(.+?)' doesn't exist for the key '(.+?)' in the '(.+?)' culture\\.","errorType":"exception","errorClass":"PluralFormNotFoundException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.Localization.Abstractions/CultureDictionary.cs","lineNumber":59,"sourceCode":"    /// <summary>\n    /// Gets the localized value.\n    /// </summary>\n    /// <param name=\"key\">The resource key.</param>\n    /// <param name=\"count\">The number to specify the pluralization form.</param>\n    /// <returns></returns>\n    public string this[CultureDictionaryRecordKey key, int? count]\n    {\n        get\n        {\n            if (!Translations.TryGetValue(key, out var translations))\n            {\n                return null;\n            }\n\n            var pluralForm = count.HasValue ? PluralRule(count.Value) : 0;\n            if (pluralForm >= translations.Length)\n            {\n                throw new PluralFormNotFoundException($\"Plural form '{pluralForm}' doesn't exist for the key '{key}' in the '{CultureName}' culture.\", new PluralForm(key, pluralForm, CultureInfo.GetCultureInfo(CultureName)));\n            }\n\n            return translations[pluralForm];\n        }\n    }\n\n    /// <summary>\n    /// Gets a list of the culture translations including the plural forms.\n    /// </summary>\n    public IDictionary<CultureDictionaryRecordKey, string[]> Translations { get; }\n\n    /// <summary>\n    /// Merges the translations from multiple dictionary records.\n    /// </summary>\n    /// <param name=\"records\">The records to be merged.</param>\n    public void MergeTranslations(IEnumerable<CultureDictionaryRecord> records)\n    {\n        foreach (var record in records)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.Localization.Abstractions/CultureDictionary.cs#L41-L77","documentation":"CultureDictionary stores translations per plural form; when a caller requests a translation with a count whose computed plural rule index exceeds the stored translations array, the dictionary throws PluralFormNotFoundException. This indicates the PO/translation source does not provide all plural forms required by the culture's plural rule (e.g. only 2 forms stored for a culture needing 3).","triggerScenarios":"Accessing CultureDictionary indexer with a count whose PluralRule(count) returns an index >= translations.Length for the key, typically due to incomplete plural translations for languages with multiple plural forms.","commonSituations":"Importing PO files with missing plural entries, switching the site to a culture (Russian, Polish, Arabic) whose plural rule needs more forms than the translation provides, or hand-written translations omitting nplurals entries.","solutions":["Fix the translation source (PO file) so the key includes all plural forms required by the culture.","Catch PluralFormNotFoundException and fall back to form 0 or the default string.","Regenerate/validate translations with the culture's nplurals rule before importing.","If you control the lookup, omit count so pluralForm resolves to 0 when a full set is unavailable."],"exampleFix":"// before (PO msgstr with only 2 forms for a 3-form culture)\nmsgstr[0] \"...\"; msgstr[1] \"...\"\n// after\nmsgstr[0] \"...\"; msgstr[1] \"...\"; msgstr[2] \"...\"","handlingStrategy":"try-catch","validationCode":"var translations = dictionary[key]; // validate count of forms loaded\nif (translations?.Length <= culturePluralFormsCount) logger.LogWarning(\"Key {Key} missing plural forms for {Culture}\", key, culture.Name);","typeGuard":null,"tryCatchPattern":"try { text = dictionary[key, count]; }\ncatch (PluralFormNotFoundException ex) { logger.LogWarning(ex, \"Missing plural form; using fallback\"); text = dictionary[key] ?? key; }","preventionTips":["Validate PO files cover all nplurals forms per culture before import","Test localization for all supported cultures with counts 0..5","Keep translations complete when adding new cultures"],"tags":["localization","pluralization","translations"],"backgroundTag":"index-out-of-range","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}