Laravel Vue i18n version 2.8.0 is a Vue 3 plugin that connects Laravel localization files (JSON and PHP) with Vue applications, including Inertia.js support. It mirrors Laravel's translation functions (__(), trans_choice(), Lang.get(), etc.) in Vue components and templates. Release cadence is active: multiple fixes and features released monthly. Key differentiators: native Laravel localization syntax, Vite plugin to auto-convert PHP translations, SSR support, and reactive current locale. Ships TypeScript types.
npm install laravel-vue-i18nVerified import paths — ran on the pinned version, not inferred.
Sets up the plugin with Vite glob import for JSON translations and uses __() helper in component.
Ensure your project uses `vue` types directly. If you encounter type errors, remove any custom augmentations of `@vue/runtime-core` and use `vue` instead.
Add `lang/php_*.json` to your `.gitignore` file.
Use the Vite plugin `i18n()` in your `vite.config.js`, or manually convert your PHP translation files to JSON.
Replace `trans()` with `tran()` or `__()` in your codebase.
Use `import.meta.glob('...', { eager: true })` and return `langs[path].default` synchronously.Ensure you call `app.use(i18nVue, ...)` after creating the Vue app, and import `__` from 'laravel-vue-i18n' if using composition API without plugin global.
Check that your JSON translation files include the key. For PHP translations, ensure the Vite plugin is configured and you have run `npm run dev` to generate the php_*.json files.
Run `npm install laravel-vue-i18n` to ensure it's installed. Import using correct path: `import i18n from 'laravel-vue-i18n/vite'` (not from the main package).