β‘ High Performance
π Significant reductions in build times, memory usage, and server load, making it ideal for large-scale projects.
Optimize your Nuxt app with a powerful and efficient i18n solution.
Nuxt I18n Micro is a fast, simple, and lightweight internationalization (i18n) module for Nuxt. Despite its compact size, it's designed with large projects in mind, offering significant performance improvements over traditional i18n solutions like nuxt-i18n. The module was built from the ground up to be highly efficient, focusing on minimizing build times, reducing server load, and shrinking bundle sizes.
The Nuxt I18n Micro module was created to address critical performance issues found in the original nuxt-i18n module, particularly in high-traffic environments and projects with large translation files. Key issues with nuxt-i18n include:
To showcase the efficiency of Nuxt I18n Micro, we conducted tests under identical conditions. Both modules were tested with a 10MB translation file on the same hardware. We also include a plain-nuxt baseline (no i18n) to measure the real overhead.
Note: The
plain-nuxtbaseline is a minimal implementation created solely for benchmarking purposes. It loads data directly from JSON files without any i18n logic. Real-world applications will have more complexity and higher resource usage.
Nuxt I18n Micro
Nuxt I18n Micro
These results clearly demonstrate that Nuxt I18n Micro significantly outperforms the original module in every critical area while staying close to the plain Nuxt baseline.
Nuxt I18n Micro is designed for large-scale projects, focusing on performance and efficiency.@i18n-micro/route-strategy (build-time) and @i18n-micro/path-strategy (runtime) to extend Nuxt pages with localized routes according to the chosen strategy (prefix, no_prefix, etc.), so each page gets the correct locale variants without manual route duplication.dev mode if not present.Install the module in your Nuxt application with:
npm install nuxt-i18n-microThen, add it to your nuxt.config.ts:
export default defineNuxtConfig({
modules: [
'nuxt-i18n-micro',
],
i18n: {
locales: [
{ code: 'en', iso: 'en-US', dir: 'ltr' },
{ code: 'fr', iso: 'fr-FR', dir: 'ltr' },
{ code: 'ar', iso: 'ar-SA', dir: 'rtl' },
],
defaultLocale: 'en',
translationDir: 'locales',
meta: true,
},
})That's it! You're now ready to use Nuxt I18n Micro in your Nuxt app.
Starting from v2.14+/v3.0.0, the i18n-micro ecosystem includes standalone packages for other frameworks and tools:
| Package | Description |
|---|---|
@i18n-micro/vue | Vue 3 integration (standalone, without Nuxt) |
@i18n-micro/react | React integration |
@i18n-micro/solid | SolidJS integration |
@i18n-micro/preact | Preact integration |
@i18n-micro/astro | Astro integration |
@i18n-micro/node | Node.js server-side loader |
@i18n-micro/core | Core utilities (shared by all packages) |
@i18n-micro/types | TypeScript type definitions |
@i18n-micro/types-generator | Auto-generate TypeScript types from translation files |
@i18n-micro/test-utils | Testing utilities |
Translations are organized into global and page-specific files: