Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add i18n support and translation for zh-CN #394

Merged
merged 19 commits into from
Dec 28, 2023
Merged

Conversation

Sevichecc
Copy link
Contributor

Relative issue: #223

Copy link

vercel bot commented Dec 19, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @evroon on Vercel.

@evroon first needs to authorize it.

@Sevichecc Sevichecc changed the title Add i18n support and zh-CN translation Add i18n support and translation for zh-CN Dec 19, 2023
Copy link

vercel bot commented Dec 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bracket ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 28, 2023 4:39pm

Copy link
Owner

@evroon evroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks a lot for this, it's very useful

I noticed the build fails:

image

Do you know what might be the problem? Otherwise, I can also look into that in a few days

frontend/public/locales/zh-CN/common.json Outdated Show resolved Hide resolved
@Sevichecc
Copy link
Contributor Author

Cool! Thanks a lot for this, it's very useful

I noticed the build fails:

image

Do you know what might be the problem? Otherwise, I can also look into that in a few days

It might be something wrong with the position of the translation hook, I will try to fix this a bit later.

@evroon
Copy link
Owner

evroon commented Dec 19, 2023

It might also be that Next is trying to build the site with server-side rendering, you could try adding these lines from the docs:

https://react.i18next.com/latest/ssr#setting-the-i18next-instance-based-on-req

@Sevichecc
Copy link
Contributor Author

It might also be that Next is trying to build the site with server-side rendering, you could try adding these lines from the docs:

https://react.i18next.com/latest/ssr#setting-the-i18next-instance-based-on-req

The error is quite straightforward, which I encountered during development but didn't give it enough attention. The error was caused by the incorrect placement of the useTranslation hook; it should not be used outside of a functional component.

Additionally, some pages did not render the translation correctly, so I've implemented some fixes for that.

Copy link
Owner

@evroon evroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

Translations look good to me overall, I have only small comments.
Could you also cherry-pick these commits onto this branch?
c49a99d
4201d52

The first one fixes yarn build which fails now because this placeholder parameter isn't allowed anymore apparently. The second just fixes formatting. After that, CI will pass.

frontend/public/locales/en/common.json Outdated Show resolved Hide resolved
frontend/public/locales/zh-CN/common.json Show resolved Hide resolved
frontend/public/locales/en/common.json Outdated Show resolved Hide resolved
@Sevichecc
Copy link
Contributor Author

Sevichecc commented Dec 25, 2023

Looks like the login page is broken, I will fix this tomorrow.

@evroon
Copy link
Owner

evroon commented Dec 28, 2023

@Sevichecc there is this error now:
image

do you want to fix it or shall I finish this PR?

@Sevichecc
Copy link
Contributor Author

@evroon I have committed a fix for that error, maybe I should try to build locally before committing.

@evroon
Copy link
Owner

evroon commented Dec 28, 2023

Thanks a lot again, let's merge this

@evroon evroon merged commit 78b6eab into evroon:master Dec 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants