Prompt
How do I debug missing plural forms in localized content
Latest observation
To debug missing plural forms in localized content, work through it from the source string to the runtime rendering. Here’s a practical checklist.
1) Confirm the source plural rules
Different languages need different plural categories.
- English typically needs:
one,other - Arabic may need:
zero,one,two,few,many,other - Some languages have more or fewer categories
If your translation only includes one and other, but the locale expects additional forms, missing forms can appear at runtime.
2) Verify the translation file structure
Check that each localized entry includes all required plural keys for that locale.
Example ICU-style message:
{
"items": {
"one": "1 item",
"other": "{count} items"
}
}
For Arabic, you might need:
{
"items": {
"zero": "No items",
"one": "1 item",
"two": "2 items",
"few": "{count} items",
"many": "{count} items",
"other": "{count} items"
}
}
3) Test boundary values
Plural bugs often show up only with specific counts.
Try:
0123451121101
Different locales map these differently, so testing only 1 and 2 is usually not enough.
4) Check fallback behavior
If a plural form is missing:
- Does your i18n library fall back to
other? - Does it fall back to the base language?
- Does it return the raw key?
- Does it silently fail?
Knowing the fallback behavior helps determine whether the issue is in translations or in resolution logic.
5) Inspect the runtime locale
Make sure the app is actually using the locale you think it is.
Common problems:
- Locale code mismatch:
en-USvsen - Wrong language negotiated from browser/user settings
- Cached locale not updated
- Server and client using different locales
6) Confirm pluralization syntax for your library
Libraries differ in how plural forms are defined.
Examples:
- ICU MessageFormat
- gettext
- i18next
- FormatJS
- Rails I18n
A message may look correct in one system but be invalid in another. Check the exact syntax your framework expects.
7) Validate translations automatically
Add linting or CI checks to catch missing plural forms.
Useful checks:
- Verify required plural categories exist per locale
- Validate message syntax
- Compare keys across locales
- Detect untranslated or empty plural variants
8) Log the plural resolution path
If possible, log:
- locale
- count
- plural category selected
- key looked up
- fallback used
This makes it much easier to see whether the issue is:
- missing translation data
- wrong plural category selection
- wrong locale
- formatting error
9) Reproduce with a minimal example
Create a tiny test case with:
- one key
- one locale
- several counts
This helps isolate whether the bug is in your translation file, rendering code, or library configuration.
10) Watch for editor or export issues
Sometimes translations are present in the source system but lost during export/import.
Check for:
- truncated JSON/YAML
- escaped braces or quotes
- overwritten keys
- translation platform dropping empty plural forms
- manual edits removing required variants
Quick diagnosis pattern
If a plural form is missing, the likely causes are:
- Only some plural categories were translated
- Locale requires more categories than expected
- Incorrect locale code
- Wrong message syntax
- Fallback masking the issue in one environment but not another
If you want, I can also give you:
- a debugging checklist for a specific library like i18next, ICU/FormatJS, or gettext, or
- a script to validate missing plural forms across your translation files.