@i18n-micro/vitepress

VitePress bindings for i18n-micro — runtime dictionaries, MD components, and locale switcher.
1,848 251
Install
npm install @i18n-micro/vitepress
Latest Version:1.1.13
Vue:3
License:MIT
Last Updated:Oct 15, 2026
Links: GitHub  ·  npm
Maintainer: s00d

@i18n-micro/vitepress

VitePress bindings for i18n-micro. One runtime API: createI18n — translations, path helpers, and (in the theme) Vue plugin + route sync.

Entries

Import Role
@i18n-micro/vitepress Client createI18n + useI18n / getLocaleFromPath
@i18n-micro/vitepress/theme defineI18nTheme (uses virtual modules from config)
@i18n-micro/vitepress/config withI18n, buildVitePressLocales, SEO head
@i18n-micro/vitepress/node Node createI18n (@i18n-micro/node + path methods)

OpenAPI-style locks: tests/integration-openapi.test.ts.
Playground SSG smoke (en/fr/de, page-scoped, SEO / disableMeta): tests/playground-ssg.test.ts.

There is no separate createVitePressRouterAdapter / path-helpers package surface — path methods hang on the createI18n instance via BaseI18n.extend.

createI18n

Theme / client

import { createI18n } from '@i18n-micro/vitepress'

const i18n = createI18n({
  locale: 'en',
  defaultLocale: 'en',
  locales: [{ code: 'en' }, { code: 'fr' }],
  messages: { en: { hi: 'Hi' }, fr: { hi: 'Salut' } },
})

i18n.localizePath('/guide', 'fr') // '/fr/guide'
i18n.t // via i18n.global / after enhanceApp
// app.use(i18n) happens inside i18n.enhanceApp({ app, router })

Prefer defineI18nTheme for zero-boilerplate sites.

Node / generators

Built on @i18n-micro/node (same createI18n / loadTranslations as Astro & CLI), plus VitePress path methods on the same object:

import { createI18n } from '@i18n-micro/vitepress/node'

const i18n = createI18n({
  locale: 'en',
  fallbackLocale: 'en',
  translationDir: './locales',
  locales: ['en', 'fr'],
  defaultLocale: 'en',
})
await i18n.loadTranslations()
i18n.t('cta.readMore')
i18n.localizePath('/guide', 'fr')

You can also import createI18n from @i18n-micro/node directly when you do not need path helpers.

Custom methods anywhere BaseI18n is used:

i18n.extend({ shout: (key) => String(i18n.t(key)).toUpperCase() })

Config

import { defineConfig } from 'vitepress'
import { withI18n, buildVitePressLocales } from '@i18n-micro/vitepress/config'

const locales = [
  { code: 'en', iso: 'en-US', displayName: 'English', og: 'en_US' },
  { code: 'fr', iso: 'fr-FR', displayName: 'Français', og: 'fr_FR' },
]
const defaultLocale = 'en'

export default defineConfig(
  withI18n(
    { locales: buildVitePressLocales(locales, defaultLocale) },
    {
      locale: defaultLocale,
      defaultLocale,
      locales,
      translationDir: 'locales',
      metaBaseUrl: 'https://example.com',
    },
  ),
)

withI18n injects themeConfig.i18nRouting automatically.

Theme

import DefaultTheme from 'vitepress/theme'
import { defineI18nTheme } from '@i18n-micro/vitepress/theme'

export default defineI18nTheme(DefaultTheme)

In pages: useI18n().localePath / switchLocale, or $t / <I18nT>.

License

MIT

Related Packages

@i18n-micro/vue

Vue 3 bindings for i18n-micro — composables, components, and routing helpers.

4,719 251
vue-translations-cleanup

A tool to find and remove unused translation keys in Vue i18n projects

3,548
@mussi/vitepress-theme

A lightweight VitePress theme extension for Ruby project documentation.

792 6
@nuxtjs/i18n

Internationalization for Nuxt

23,877,608 2,085

Version History

Version Released Vue License
1.1.13 ^3.5.43 MIT
1.1.12 ^3.5.43 MIT
1.1.11 ^3.5.42 MIT
1.1.10 ^3.5.42 MIT
1.1.9 ^3.5.42 MIT