QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.26k stars 59 forks source link

About the issue of my next-international not working and showing an error. #206

Closed duoluodexiaoxiaoyuan closed 11 months ago

duoluodexiaoxiaoyuan commented 11 months ago

Describe the bug image

this is my repo: https://github.com/duoluodexiaoxiaoyuan/mynextproject/tree/usei18n

i don't sure is my problem about use js or put file location error.

Expected behavior A clear and concise description of what you expected to happen.

About (please complete the following information):

QuiiBz commented 11 months ago

Hi, you have to move every folder inside the [locale] folder, so about, contact, profile, header.jsx, layout.js, loading.js, and not-found.js.

duoluodexiaoxiaoyuan commented 11 months ago

https://github.com/duoluodexiaoxiaoyuan/mynextproject/tree/usei18n

thank u, i know.

QuiiBz commented 11 months ago

You're using useCurrentLocale() in a file (header.jsx) that isn't inside the [locale] folder. You should move it from src/app/header.jsx to src/app/[locale]/header.jsx

duoluodexiaoxiaoyuan commented 11 months ago

You're using useCurrentLocale() in a file (header.jsx) that isn't inside the [locale] folder. You should move it from src/app/header.jsx to src/app/[locale]/header.jsx

i see this example: https://codesandbox.io/p/sandbox/wizardly-shaw-vzfwfc?file=%2Fapp%2F%5Blocale%5D%2Fclient%2Fpage.tsx%3A1%2C1-20%2C2

QuiiBz commented 11 months ago

That's because header.jsx isn't a page, so it can be used anywhere. You should move any pages (page.jsx) into the [locale] folder.

duoluodexiaoxiaoyuan commented 11 months ago

That's because header.jsx isn't a page, so it can be used anywhere. You should move any pages (page.jsx) into the [locale] folder.这是因为 header.jsx 不是一个页面,所以它可以在任何地方使用。您应该将所有页面( page.jsx )移动到 [locale] 文件夹中。

thank u, i know.

QuiiBz commented 11 months ago

I'm not sure to understand correctly, do you still have an error and need help? Or is it resolved?

duoluodexiaoxiaoyuan commented 11 months ago

I'm not sure to understand correctly, do you still have an error and need help? Or is it resolved?

i restart a typescript project, now it's ok, thank u, occur i start a new knowledge, i need to clean enviroment. otherwise alwayles meet many strange problems

duoluodexiaoxiaoyuan commented 11 months ago

First, thank u author patient reply. if someone want to use quickly i18n, this is my demo with next and next-international,this is https://github.com/duoluodexiaoxiaoyuan/mynextappusets/tree/usei18nrouter.

use a new library and success apply own project need meet some difficult, I hope my experience can help u quickly to learn.

I previous never use i18n. But now i need to learn, because i have requirements now.

image

i don't sure what relationship about Minimal i18n routing and translations , next-intl, next-international, next-i18n-router.

I think four methods to impl i18n. it's independent.

so i choose next-international.

open source is a happy things, but it's tired. thank u author.

As a beginner, try to create issue is a great start. A good project need more particular.