์ž‘๊ฐ€:
    ์ƒ์„ฑ:2026-06-13๋งˆ์ง€๋ง‰ ์—…๋ฐ์ดํŠธ:2026-09-27

    @intlayer/react-i18next: react-i18next ํ˜ธํ™˜ ์–ด๋Œ‘ํ„ฐ

    ์™„์ „ํ•˜๊ณ  ์ƒ์„ธํ•œ ๋‹จ๊ณ„๋ณ„ ํŠœํ† ๋ฆฌ์–ผ์€ react-i18next ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๊ฐ€์ด๋“œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

    Intlayer์˜ compat adapter๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์†Œ์Šค ์ฝ”๋“œ import์— ๋ณ€๊ฒฝ ์—†์ด react-i18next์—์„œ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ˆ˜ํ–‰ํ•  ์ž‘์—…

    ํ”„๋กœ์ ํŠธ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์‹คํ–‰ํ•˜์„ธ์š”:

    bash
    npx intlayer init --interactive
    

    ์ดˆ๊ธฐํ™” ์ค‘์— Intlayer๋Š” @intlayer/react-i18next๋ฅผ ์„ค์น˜ํ•˜๊ณ  intlayer.config.ts๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. bundler(์˜ˆ: Vite)์—์„œ Intlayer plugin์„ ์ ์šฉํ•˜์„ธ์š”:

    vite.config.ts
    import { defineConfig } from "vite";
    import react from "@vitejs/plugin-react";
    import { reactI18nextVitePlugin } from "@intlayer/react-i18next/plugin";
    
    export default defineConfig({
      plugins: [react(), reactI18nextVitePlugin()],
    });
    

    ๋‚ด๋ถ€ ๋™์ž‘ ์›๋ฆฌ

    reactI18nextVitePlugin์€ ํ•ต์‹ฌ vite-intlayer plugin์„ ๋ž˜ํ•‘ํ•˜๊ณ  react-i18next ๋ฐ i18next์— ๋Œ€ํ•œ resolve alias๋ฅผ ์ฃผ์ž…ํ•˜์—ฌ @intlayer/react-i18next ๋ฐ @intlayer/i18next๋กœ ๋ฆฌ๋””๋ ‰์…˜ํ•ฉ๋‹ˆ๋‹ค.

    ๋‚ด๋ถ€์ ์œผ๋กœ:

    • useTranslation & withTranslation: Intlayer์˜ ๊ธฐ๋ณธ hook์„ ์‚ฌ์šฉํ•˜๋„๋ก ๋‹ค์‹œ ์ž‘์„ฑ๋˜์–ด dictionary key์— ๋Œ€ํ•œ ์ž๋™ TypeScript ์ž๋™ ์™„์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. namespace(์˜ˆ: t('namespace:key'))๋ฅผ ์›ํ™œํ•˜๊ฒŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
    • ๋ณต์ˆ˜ํ˜• & Context: ๋„ค์ดํ‹ฐ๋ธŒ Intl.PluralRules ๋ฐ context ์ ‘๋ฏธ์‚ฌ(key_male)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ i18next์˜ ์ ‘๋ฏธ์‚ฌ ๊ธฐ๋ฐ˜ ๋ณต์ˆ˜ํ™”(key_one, key_other)๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
    • <Trans> Component: components prop, ๊ฐ์ฒด ๋ฐ ๋ฐฐ์—ด ํ˜•์‹, ๊ทธ๋ฆฌ๊ณ  ๋ฒˆํ˜ธ๊ฐ€ ๋งค๊ฒจ์ง„ ํƒœ๊ทธ <1>...</1>๋ฅผ React ๋…ธ๋“œ์— ์ง์ ‘ ๋งคํ•‘ํ•˜๋„๋ก ์ง€์›ํ•˜๋„๋ก ๋‹ค์‹œ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
    • i18n instance: ๋Œ€๊ทœ๋ชจ JSON ํŒŒ์ผ์„ ๊ฐ€์ ธ์˜ค์ง€ ์•Š๊ณ  Intlayer์—์„œ ์ง์ ‘ ํ‚ค๋ฅผ ํ•ด๊ฒฐํ•˜์—ฌ ๋ฒˆ๋“ค ํฌ๊ธฐ๋ฅผ ํ›จ์”ฌ ์ค„์ž…๋‹ˆ๋‹ค.
    ์ด๋Ÿฌํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์–ด๋””์—์„œ ์™”๋Š”์ง€ ์ดํ•ดํ•˜๋ ค๋ฉด JavaScript i18n์˜ ์—ญ์‚ฌ๋ฅผ ์ฝ์–ด๋ณด์„ธ์š”.