{{ t('named', { msg }) }}
{{ t('list', [msg]) }}
{{ t('literal') }}
{{ t('linked') }}
``` For more details of `t`, see the [API Reference](../../api/general/interfaces/Composer.md#t) ## Pluralization The plural form of the message uses the same syntax, and is translated using `t`: ```vue{{ t('car', 1) }}
{{ t('car', 2) }}
{{ t('apple', 0) }}
{{ t('apple', 1) }}
{{ t('apple', { count: 10 }, 10) }}
{{ t('apple', 10) }}
{{ t('banana', { n: 1 }, 1) }}
{{ t('banana', 1) }}
{{ t('banana', { n: 'too many' }, 100) }}
``` :::tip NOTE Plural translations are integrated into `t`. ::: ## Datetime Formatting Use the `d` function from the Composer instance to format datetime values: ```vue{{ t('current') }}: {{ d(now, 'long') }}
``` For more details of `d`, see the [API Reference](../../api/general/interfaces/Composer.md#d) ## Number Formatting Use the `n` function from the Composer instance to format number values: ```vue{{ t('money') }}: {{ n(money, 'currency') }}
``` For more details of `n`, see the [API Reference](../../api/general/interfaces/Composer.md#n) ## Global scope A global scope is created when an i18n instance is created with `createI18n`. The `global` property of the i18n instance references the global Composer instance. There are two ways to refer the global scope Composer instance at the component. ### Explicit with `useI18n` You can explicitly access the global scope by passing `useScope: 'global'` to `useI18n`: ```ts import { useI18n } from 'vue-i18n' const { t } = useI18n({ useScope: 'global' }) // Something to do here ... ``` The above code sets the `useI18n` option to `useScope: 'global'`, which allows `useI18n` to return a Composer instance that can be accessed by the i18n instance `global` property. The Composer instance is a global scope. Then you can compose using the functions and properties exposed from the Composer instance. :::tip NOTE If you set `useI18n` to `messages`, `datetimeFormats`, and `numberFormats` together `useScope: 'global'`, **they will be merged into global scope**. That is, they will be managed by `messages`, `datetimeFormats`, and `numberFormats` of the global scope Composer instance. And also, if [`global` is specified in i18n custom blocks](../advanced/sfc#define-locale-messages-for-global-scope) (e.g. `{{ status }}
``` :::tip NOTE The isolated scope inherits locale from the global scope by default. When the global locale changes, the isolated scope's locale is automatically updated. You can disable this behavior by setting `inheritLocale: false`. ::: ## Mapping from VueI18n to Composer If you are migrating from v11 or earlier, see the [v12 Breaking Changes](../migration/breaking12#drop-legacy-api-mode) for a detailed mapping between the VueI18n instance (Legacy API) and the Composer instance (Composition API).