अपने प्रश्न को पूछें और दस्तावेज़ का सारांश प्राप्त करें, इस पृष्ठ और आपके चुने हुए AI प्रदाता का उपयोग करके
संस्करण इतिहास
- "Init history"v9.0.013/6/2026
इस पृष्ठ की सामग्री एक AI द्वारा अनुवादित की गई है।
अंग्रेजी में मूल सामग्री के अंतिम संस्करण देखें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
i18next से Intlayer में माइग्रेट करें
विस्तृत चरण-दर-चरण ट्यूटोरियल के लिए, कृपया हमारी संपूर्ण i18next Migration Guide देखें।
Intlayer perfectly replicates the core runtime characteristics of i18next. compat package का उपयोग करके, आपके Vanilla applications या internal modules परिचित syntax का लाभ उठाना जारी रख सकते हैं।
क्या करें
शुरुआत करने के लिए, अपनी project में Intlayer को initialize करें:
कोड को क्लिपबोर्ड पर कॉपी करें
npx intlayer initयदि आप Vite का उपयोग कर रहे हैं, तो @intlayer/i18next के लिए imports को route करने के लिए Intlayer plugin को शामिल करें:
कोड को क्लिपबोर्ड पर कॉपी करें
import { defineConfig } from "vite";import { i18nextVitePlugin } from "@intlayer/i18next/plugin";export default defineConfig({ plugins: [i18nextVitePlugin()],});यह हुड के नीचे क्या करता है
i18nextVitePlugin i18next imports को @intlayer/i18next के लिए alias करता है, JSON फ़ाइल inclusions से bundle bloat को रोकता है।
हुड के नीचे:
- Instance configuration:
createInstancenamespace fallbacks को सही तरीके से parse और apply करता है जबकि dictionary retrieval के लिए Intlayer के compilation pipeline का लाभ उठाता है। - Interpolation:
{{name}}replacements और$t(key)nesting के लिए native support recursively। - Context & Plurals:
key_maleऔरkey_one/key_otherजैसे suffix formats को identify और resolve करता है, standardIntl.PluralRulesके विरुद्ध evaluate करते हुए। - Return objects:
returnObjects: truemode safely Intlayer dictionaries से trees को extract करता है।