שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Init history"v9.0.013.6.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
@intlayer/vue-i18n: Compat Adapter for vue-i18n
If your Vue application currently uses vue-i18n, you can migrate to Intlayer without rewriting your components or translating hooks. Intlayer provides a compat adapter that perfectly mirrors vue-i18n's API while leveraging Intlayer's powerful features under the hood.
What to do
To get started, simply run the initialization command in your project:
העתקת הקוד ללוח
During the initialization, Intlayer will set up your configuration file (intlayer.config.ts) and prepare your project for migration. You will just need to add the Intlayer plugin to your Vite configuration to automatically alias the vue-i18n imports.
העתקת הקוד ללוח
What it does under the hood
The vueI18nVitePlugin injects a module alias into your bundler. Any import of vue-i18n in your codebase will be transparently redirected to @intlayer/vue-i18n.
Under the hood, the adapter handles the complex vue-i18n syntax natively:
- Interpolation & Plurals: Resolves
{name}and list{0}interpolations. Pipe plurals ("car | cars") are converted into Intlayer enumeration/plural nodes based on positional semantics. - Formats: Functions like
d()andn()wrapIntlunder the hood, honoring thedatetimeFormatsandnumberFormatsdefined in your options. - Global & Local State:
global.localeis mapped to aWritableComputedRefbacked by the Intlayer client, so reactivity behaves exactly as expected (e.g.locale.value = 'fr'). - Directives: The
v-tdirective is registered and functions normally.
Your application continues rendering exactly as before, but the content is powered by your Intlayer dictionaries, giving you type safety, better bundle optimization, and seamless CMS integration.
To understand where these libraries come from, read the history of JavaScript i18n.
