[NextJS] i18n - Internationalization

Darcy Daeseok YU ·2025년 6월 8일

i18n

library: next-intl

next-intl-

Prefix-based routing

(e.g. /en/about or /ko/about)

Folder structure

  • messages(added)

    • en.json
    • ko.json
  • next.config.json(updated)

  • src

    • middleware.ts(added or updated)

    • i18nConfig.ts(added)

    • types

      • global.d.ts(updated)
    • app

      • locale

        • (private) with login
        • (public) without login
      • api

Caution

NextJS Params Type

Component : params is a plain, resolved Javascript object.

generateMetadata : These function runs in a different context within Next.js's build/render pipeline. It needs to be flexible enough to receive params either as an already-resolved object or as a Promise (e.g., if a parent layout.tsx is still resolving its own params or if it's being called as part of a deeper resolution chain). To ensure it works correctly in all these scenarios, Next.js provides it as a Promise type, requiring you to await it.

next-intl Params Type (25.06.08)

Promise as stopgap solution

profile
React, React-Native https://darcyu83.netlify.app/

0개의 댓글