استخدم مساعدك المفضل للملخص واستخدم هذه الصفحة والموفر AI الذي تريده
تاريخ الإصدارات
- "Init history"v9.0.0١٣/٦/٢٠٢٦
تمت ترجمة محتوى هذه الصفحة باستخدام الذكاء الاصطناعي.
اعرض آخر نسخة المحتوى الأصلي باللغة الإنكليزيةIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
Migrate from i18next to Intlayer
For a detailed step-by-step tutorial, please see our full i18next Migration Guide.
Intlayer perfectly replicates the core runtime characteristics of i18next. By utilizing the compat package, your Vanilla applications or internal modules can continue to leverage familiar syntax.
What to do
To begin, initialize Intlayer in your project:
نسخ الكود إلى الحافظة
npx intlayer initIf you are using Vite, include the Intlayer plugin to route imports to @intlayer/i18next:
نسخ الكود إلى الحافظة
import { defineConfig } from "vite";import { i18nextVitePlugin } from "@intlayer/i18next/plugin";export default defineConfig({ plugins: [i18nextVitePlugin()],});What it does under the hood
The i18nextVitePlugin aliases i18next imports to @intlayer/i18next, avoiding bundle bloat from JSON file inclusions.
Under the hood:
- Instance configuration:
createInstancecorrectly parses and applies namespace fallbacks while leveraging Intlayer's compilation pipeline for dictionary retrieval. - Interpolation: Native support for
{{name}}replacements and$t(key)nesting recursively. - Context & Plurals: Identifies and resolves suffix formats like
key_maleandkey_one/key_otherevaluating against standardIntl.PluralRules. - Return objects: The
returnObjects: truemode safely extracts trees from Intlayer dictionaries.