frontend icon indicating copy to clipboard operation
frontend copied to clipboard

feat: Add i18n

Open curtisy1 opened this issue 3 years ago • 5 comments

This adds react-i18next and a dropdown to dynamically toggle the language anytime.

I also added an English translation which is based on Google Translate since I'm not Chinese and don't speak the language. Should be better than nothing though, with way for improvement by the community.

English is the default language for the translation keys, so new developers will have an easier time reading the code. If you would like the keys to be Chinese instead, I can change it back.

As a bonus, I also fixed the unit tests. Some of them were broken due to the i18n adjustments, while most probably didn't work in the first place due to cloudreveApp not being called correctly.

curtisy1 avatar Oct 10 '21 11:10 curtisy1

Wow, Thanks! This is a really big effort! I will take some time to review it later.

HFO4 avatar Oct 10 '21 12:10 HFO4

No worries! I figured if I started using Cloudreve, I needed to add some translation anyway. Although most of it is Google Translate'd for now, so adjusting the translations a bit is probably still necessary

curtisy1 avatar Oct 10 '21 14:10 curtisy1

Thanks for the PR, but I have to close it. We're already working on designing i18n support in the backend side, it is planned to he shipped in next few versions. It seems conflicted with your change. Also, using Google translated version is not a good idea. Sorry about that!

HFO4 avatar Oct 11 '21 13:10 HFO4

Alright, seems reasonable. Thanks for the heads up! If you need any help with getting i18n up and running on the backend side or need someone to proofread, feel free to get in touch.

Also, would you be okay with me leaving the fork open for people to use in the meantime? I think there's a few open issues about it in the backend repo that might benefit from it, even though the translations might be a bit off in some places

curtisy1 avatar Oct 11 '21 21:10 curtisy1

Sure! I'll leave it open till official support shipped.

HFO4 avatar Oct 12 '21 11:10 HFO4