Skip to content
loclizr

This site compiles its own catalogs with loclizr build. The widgets below call the generated functions in your browser, with no ICU parser and no request to a server.

Hello, Ada!

3 items in your cart

Total: €73.50

On its way

Updated Oct 3, 2026

m.demo_items({ count: 3 }, { locale: 'en' })

Every line is one generated function called with the chosen locale, as the line under the output shows. The page itself stays English, so the demo passes { locale } per call instead of calling setLocale.

English (en)3 items in your cartTotal: €73.50
Deutsch (de)3 Artikel im WarenkorbSumme: 73,50 €
Français (fr)3 articles dans votre panierTotal : 73,50 €
Español (es)3 artículos en tu carritoTotal: 73,50 €
Português (pt)3 itens no seu carrinhoTotal: € 73,50
Italiano (it)3 articoli nel carrelloTotale: 73,50 €
Polski (pl)3 produkty w koszykuRazem: 73,50 €
Українська (uk)3 товари в кошикуРазом: 73,50 EUR
العربية (ar)3 منتجات في سلتكالمجموع: ‏73.50 €
हिन्दी (hi)आपकी कार्ट में 3 आइटम हैंकुल: €73.50
日本語 (ja)カートに3点の商品があります合計: €73.50
中文 (zh)购物车中有 3 件商品合计:€73.50
한국어 (ko)장바구니에 상품 3개가 있습니다합계: €73.50

Try 1, 2, 5, 22 and 1000000. Polish and Ukrainian switch between one, few and many, Arabic has six forms, and Japanese, Chinese and Korean have one. 0 hits the exact =0 branch in every language.

loclizr.config.ts
import { defineConfig } from 'loclizr'
export default defineConfig({
locales: ['en', 'de', 'fr', 'es', 'pt', 'it', 'pl', 'uk', 'ar', 'hi', 'ja', 'zh', 'ko'],
sourceLocale: 'en',
})
locales/en.json
{
"demo": {
"greeting": "Hello, {name}!",
"items": "{count, plural, =0 {Your cart is empty} one {# item in your cart} other {# items in your cart}}",
"total": "Total: {amount, number, ::currency/EUR}",
"updated": "Updated {at, date, medium}",
"status": "{state, select, packing {Being packed} shipped {On its way} delivered {Delivered} other {Processing}}"
}
}
locales/pl.json
{
"demo": {
"greeting": "Cześć, {name}!",
"items": "{count, plural, =0 {Twój koszyk jest pusty} one {# produkt w koszyku} few {# produkty w koszyku} many {# produktów w koszyku} other {# produktu w koszyku}}",
"total": "Razem: {amount, number, ::currency/EUR}",
"updated": "Zaktualizowano {at, date, medium}",
"status": "{state, select, packing {Pakowanie} shipped {W drodze} delivered {Dostarczono} other {W realizacji}}"
}
}
locales/ar.json
{
"demo": {
"greeting": "مرحبًا، {name}!",
"items": "{count, plural, =0 {سلتك فارغة} zero {لا توجد منتجات في سلتك} one {منتج واحد في سلتك} two {منتجان في سلتك} few {# منتجات في سلتك} many {# منتجًا في سلتك} other {# منتج في سلتك}}",
"total": "المجموع: {amount, number, ::currency/EUR}",
"updated": "آخر تحديث: {at, date, medium}",
"status": "{state, select, packing {قيد التغليف} shipped {في الطريق} delivered {تم التوصيل} other {قيد المعالجة}}"
}
}

Every translation lists exactly the plural categories Intl.PluralRules reports for its language. Drop few from the Polish plural and the build says so:

warn LZ3007 plural-category-incomplete locales/pl.json:4:15 pl demo.items
pl selects few for some values of {count}, and this plural has no branch for it.
fix add few {...} to {count, plural, ...} in locales/pl.json

See Catalogs for the message syntax and Language switching for setLocale in an app.