Prompt
locale fallback and pluralization tool
Latest observation
Nov 2, 2026
OpenAI APIWeb search: off
If you want a locale fallback + pluralization tool, here are the most common options depending on your stack.
Good ready-made libraries
JavaScript / TypeScript
- i18next — very popular, supports:
- locale fallback chains
- pluralization
- interpolation
- namespaces
- FormatJS / react-intl — strong ICU message support, good plural rules
- Lingui — lightweight, good pluralization and message formatting
Python
- Babel — locale data, plural rules, formatting
- gettext — classic i18n, plural forms supported via
.pofiles - Flask-Babel / Django i18n — framework-integrated support
Ruby
- I18n gem — built-in fallback support and pluralization
Java
- ICU4J — excellent locale + pluralization support
- Spring MessageSource — common in Spring apps
.NET
- Humanizer or built-in
ResourceManagerwith ICU-like patterns depending on setup
If you want a custom tool
A simple locale fallback algorithm usually works like:
- Try exact locale:
pt-BR - Try base language:
pt - Try default locale:
en - If not found, return key
Pluralization typically uses rules like:
oneother- sometimes
zero,few,many,two
Example:
{
"en": {
"cart.items": {
"one": "1 item",
"other": "{count} items"
}
},
"pt": {
"cart.items": {
"one": "1 item",
"other": "{count} itens"
}
}
}
Then:
count = 1→onecount = 3→other
Recommended choice
- Web apps / JS:
i18next - ICU-style message formatting:
FormatJS - Python:
Babel - Framework-native: use your framework’s i18n system first
If you want, I can also provide:
- a small custom implementation, or
- a comparison table of the best tools by language/framework.