solid-primitives-i18n

The preset for @solid-primitives/i18n. It reads t calls in Solid components and scripts, and {{name}} placeholders.

The solid-primitives-i18n preset supports @solid-primitives/i18n in SolidJS projects.

Detection

The preset applies when the project depends on @solid-primitives/i18n.

x18n.config.ts
import { solidPrimitivesI18n } from '@x18n/cli/presets'
import { defineConfig } from '@x18n/core'

export default defineConfig({
  presets: [solidPrimitivesI18n()],
})

Supported syntax

These names count as translate calls: t and i18n.t. Dictionary keys are dot paths.

src/App.tsx
const t = i18n.translator(dict)

export default () => <h1>{t('home.title', { name: 'Ada' })}</h1>

Placeholders

Double braces: {{name}}.

Extraction templates

KindsTemplate
jsx-text{t('{key}'{args})}
jsx-attribute{attr}={t('{key}'{args})}
js-string, js-templatet('{key}'{args})