general
The general preset applies to every project. It comes last in the detection order, so the presets of libraries come first.
What it adds
The preset adds the default extraction templates, for example t('{key}'{args}) for strings in JS and TS. It adds no translate calls.
A project without a library preset therefore has no translate calls, and x18n finds no usages. Add your calls in usage.calls:
import { defineConfig } from '@x18n/core'
export default defineConfig({
usage: {
calls: [
{ callee: ['t', 'i18n.t'] },
{ callee: 'useTranslate', factory: true, returns: ['t'] },
],
},
})See the item fields of usage.calls. For a library that x18n does not support, a YAML plugin can hold the calls, placeholders and templates in one file.
Detection
The preset always applies, unless an exclusive preset applied before it, or you list presets yourself. x18n tries the default templates last in every project, with or without this preset, so x18n extract always has a template.