slidev-addon-i18nb
v0.2.6
Published
i18n addon for Slidev
Readme
Auto transform slidev content to i18n format by AI.
Installation
npm i slidev-addon-i18nbUsage
Auto transform by AI
Add the
addonsandi18noption in headmatter--- addons: - slidev-addon-i18nb i18n: autoTransform: true languages: - en - ja - zh_CN ---i18nConfiguration- autoTransform: Whether to automatically transform markdown content to i18n format.
- languages: Specify the languages supported by the addon.
Set env variables in .env file
I18N_AI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/ I18N_AI_API_KEY=GeminiApiKey I18N_AI_MODEL=gemini-2.5-flash-preview-05-20Run the command to transform the markdown content to i18n format:
npm run dev slides_auto.mdCheck the dir
locales_autofor the generated translation files.And
slides_transformed.mdfor the transformed slides info.PS.
slides_transformed.mdis just for reference, you can delete it after the translation is done.
Manual translation
Add the addon in headmatter
--- addons: - slidev-addon-i18nb ---Create
localesdirectory in the root of your project, and add your locale files likeen.yml,zh.yml, etc.# locales/en.yml title: Slidev i18n addon intro: desc: This is a demo of Slidev i18n addonUse
{{ $t("<key>") }}to write i18n.# {{ $t("title") }} {{ $t("intro.desc") }} *{{ $t("intro.desc") }}* **{{ $t("intro.desc") }}** > {{ $t("intro.desc") }} ~~{{ $t("intro.desc") }}~~
Default languages name:
const langName: LangNameType = {
ar: 'العربية',
de: 'Deutsch',
en: 'English',
es: 'Español',
fr: 'Français',
hi: 'हिन्दी',
it: 'Italiano',
ja: '日本語',
ko: '한국어',
nl: 'Nederlands',
pt: 'Português',
ru: 'Русский',
zh: '中文',
zh_CN: '简体中文',
zh_TW: '繁體中文',
}