i18n-tag
The preset for es2015-i18n-tag. It reads i18n tagged templates in JS, TS and Vue files.
The i18n-tag preset supports es2015-i18n-tag.
Detection
The preset applies when the project depends on es2015-i18n-tag.
x18n.config.ts
import { i18nTag } from '@x18n/cli/presets'
import { defineConfig } from '@x18n/core'
export default defineConfig({
presets: [i18nTag()],
})Locale files
The preset adds no resource patterns. Set resources in the config, or let x18n guess the locale directories. For example, x18n finds locales/en.json without a config.
Supported syntax
In JS, TS and Vue files, the preset reads the i18n tagged template. The text of the template is the key:
src/a.js
const x = i18n`Hello`This is a usage of the key Hello.
Placeholders
The preset adds no placeholder syntax.
Extraction templates
| Kinds | Template |
|---|---|
js-string, js-template | i18n`{key}` |