# Usage

# general formatting

Locale messages:

const messages = {
  en: {
    message: {
      hello: "hello world",
    },
  },
};

Template:

<p>{{ $t('message.hello') }}</p>

Output:

<p>hello world</p>

# Named formatting

Locale messages:

const messages = { en: { message: { hello: "{msg} world" } } };

Template:

<p>{{ $t('message.hello', { msg: 'hello' }) }}</p>

Output:

<p>hello world</p>

# List formatting

Locale messages:

const messages = {
  en: {
    message: {
      hello: "{0} world",
    },
  },
};

Template:

<p>{{ $t('message.hello', ['hello']) }}</p>

Output:

<p>hello world</p>

List formatting also accepts array-like objects:

<p>{{ $t('message.hello', {'0': 'hello'}) }}</p>

Output:

<p>hello world</p>