अपने प्रश्न को पूछें और दस्तावेज़ का सारांश प्राप्त करें, इस पृष्ठ और आपके चुने हुए 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
Migrate from Lingui to Intlayer
If your project currently relies on Lingui's macro-based compilation, transitioning to Intlayer allows you to maintain your powerful macro workflows while backing them natively with Intlayer's JSON compilation strategy.
What to do
To begin, initialize Intlayer in your project:
कोड को क्लिपबोर्ड पर कॉपी करें
npx intlayer initThis creates your intlayer.config.ts. Ensure you retain @lingui/babel-plugin-lingui-macro / @lingui/swc-plugin in your build step to run before the Intlayer compiler. Then, use the bundler plugin alias to route @lingui/core and @lingui/react to @intlayer/lingui.
What it does under the hood
Lingui utilizes macros (like t`Hello ${name}` and <Trans>) which are compiled into runtime calls like i18n._(id, values).
Under the hood:
- Macros: They compile precisely as they did before, ensuring no disruption in your source syntax.
- Runtime translation: The aliased
i18n._()uses Intlayer dictionaries. Both explicitly named IDs and hashed IDs are fully mapped using Intlayer's.posync plugins to aggregate and prune keys securely. - ICU capabilities: Support for pluralization, selection, and ICU variants remains robust due to Intlayer's unified ICU parser, ensuring identical rendering outputs.