{"record":{"id":"833ad2013e1a1854","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-ordinal-defines-uns","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.ordinal' defines unsupported property '{property}'. Supported properties: numeric, date, dateOnly.","messagePattern":"Locale '(.+?)\\.surfaces\\.ordinal' defines unsupported property '(.+?)'\\. Supported properties: numeric, date, dateOnly\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":408,"sourceCode":"                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number.formatting.{propertyName}' must be a scalar string, not a mapping or sequence.\");\n            }\n\n            if (string.IsNullOrEmpty(scalar.Value))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.number.formatting.{propertyName}' must be a non-empty string.\");\n            }\n        }\n\n        static void AddOrdinalFeatures(\n            string localeCode,\n            SimpleYamlMapping ordinalSurface,\n            ImmutableDictionary<string, SimpleYamlValue>.Builder features)\n        {\n            foreach (var property in ordinalSurface.Values.Keys.Where(static property => property is not (\"numeric\" or \"date\" or \"dateOnly\")))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.ordinal' defines unsupported property '{property}'. Supported properties: numeric, date, dateOnly.\");\n            }\n\n            if (ordinalSurface.TryGetValue(\"numeric\", out var numericValue))\n            {\n                if (numericValue is not SimpleYamlMapping numericMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.numeric' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"ordinalizer\"] = numericMapping;\n            }\n\n            if (ordinalSurface.TryGetValue(\"date\", out var dateValue))\n            {\n                if (dateValue is not SimpleYamlMapping dateMapping)\n                {","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L390-L426","documentation":"Thrown by AddOrdinalFeatures when surfaces.ordinal in a locale YAML contains a property other than the three allowed keys: numeric, date, dateOnly. The ordinal surface is closed, so any extra key (e.g. legacy 'words', 'abbreviations') is rejected at build time.","triggerScenarios":"A contributor adds an unsupported key under surfaces.ordinal. The allow-list loop at CanonicalLocaleAuthoring.cs:404-409 flags the offending property and throws.","commonSituations":"Migrating from an older ordinal schema that used different property names; pasting ordinal config from another i18n library; adding locale-specific ordinal variants not yet supported by the schema.","solutions":["Remove the unsupported property '{property}' from surfaces.ordinal.","Map the data onto the supported keys: numeric (ordinalizer), date (dateToOrdinalWords), or dateOnly (dateOnlyToOrdinalWords).","If a genuinely new ordinal surface is needed, extend AddOrdinalFeatures and SupportedSurfaceNames in the generator first."],"exampleFix":"# before\nordinal:\n  words:\n    1: first\n# after\nordinal:\n  numeric:\n    1: first","handlingStrategy":"validation","validationCode":"# Validate ordinal surface keys against the allow-list.\n$allowed = 'numeric','date','dateOnly'\n# Parse the locale YAML and assert every key under surfaces.ordinal is in $allowed.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the ordinal surface is closed: numeric, date, dateOnly only.","Map any legacy ordinal data onto these three keys.","Extend AddOrdinalFeatures in the generator before introducing a new ordinal surface."],"tags":["localization","yaml","source-generator","locale","build","ordinal"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}