i18next
-
[Next] i18n 사용법 with next-i18nextNext.js 2022. 11. 13. 23:06
1. 설치 yarn add next-i18next npm install next-i18next 2. 사용법 (1) 루트 디렉토리에 next-18next.config.js 생성 module.exports = { i18n: { defaultLocale: "en", locales: ["en", "ko"], // 지원하는 locale 목록 }, }; (2) public 폴더 → locales 폴더 → 각 언어 코드 폴더 (en, ko) → common.json next.js 에서 i18n을 지원하고 있기 때문에, public/locales 라는 지정된 폴더 위치에 생성하면 됨. (3) next.config.js 에 next-18next.config.js 추가 /** @type {import('next').Nex..