728x90
https://www.npmjs.com/package/next-i18next
next-i18next
The easiest way to translate your NextJs apps.. Latest version: 14.0.0, last published: a month ago. Start using next-i18next in your project by running `npm i next-i18next`. There are 125 other projects in the npm registry using next-i18next.
www.npmjs.com
1. 그대로 따라하면 된다!!
2. 주의할 점은, 페이지 level에서 getStaticProps를 추가하면, 해당 파일에서는 useTranslation을 사용하지 못한다는 점이다.
3. useTranslation을 매 파일마다 import해서 쓰기 귀찮으니까, custom hook을 하나 만들어줬다.
// use-t.ts
import { useTranslation } from "next-i18next";
export const useT = () => {
const result = useTranslation("common");
return {
...result,
};
};
// usage
export default function Category(props) {
const { t } = useT();
return (
...
<Typography.P14_Bold
content={t("loot_box")}
color={...}
/>
...
)
}
'Solve Problem > Guide | Tip' 카테고리의 다른 글
파일구조 예쁘게 보는 법: 파일트리 (tree) (0) | 2023.07.26 |
---|---|
구글 플레이스토어 주문 ID 해석하기 (.. 뒤에 붙은 숫자의 비밀!) (0) | 2023.02.23 |
dayjs 제대로 활용하기: getTimezoneOffset (0) | 2023.02.17 |
🎨아스키 아트를 아시나요? :: 텍스트와 특수문자만으로 사진,그림 흉내내기 (0) | 2023.02.09 |
Prefill Google Form Input Dynamically : 구글폼 설문 답변 미리 채우기(동적으로) (0) | 2023.01.25 |