Service

Interpolation

Double-brace placeholders inside catalog values get filled at render time. Missing params resolve to an empty string — never a stray brace in the UI.

Catalog shape

Use double braces around the param name — any string-coercible value (string, number, boolean) is rendered as-is. Objects fall back to JSON.stringify.

{
  "app": {
    "title": "Welcome",
    "hello": "Hello, {{name}}!",
    "items": "{{count}} item(s) selected"
  }
}

Live

The same key, two locales, one input — type your name to see the placeholder resolve in real time.

Hello, Ada!

Locale: en

<p>{{ 'app.hello' | wrT: { name: user().name } }}</p>
<p>{{ 'app.items' | wrT: { count: selection().length } }}</p>

Reusable formatter

useI18nFormatter(key) returns a (params) => string helper — handy when the same parametrized label gets reused inside expressions.

import { useI18nFormatter } from 'ngwr/i18n';

const formatItems = useI18nFormatter('app.items');
// formatItems({ count: 3 }) → '3 item(s) selected'