Change how duplicate values are stored and add Chinese Traditional for i18n#161
Change how duplicate values are stored and add Chinese Traditional for i18n#161antonreshetov merged 4 commits intomassCodeIO:masterfrom sangyuxiaowu:master
Conversation
src/main/services/i18n/index.ts
Outdated
| i18next.use(Backend).init({ | ||
| fallbackLng: 'en', | ||
| lng: store.preferences.get('language'), | ||
| lng: lng, |
There was a problem hiding this comment.
No need to duplicate if prop is the same as the name of a local variable
There was a problem hiding this comment.
I get it, I tried it and it works. 😀
There was a problem hiding this comment.
Do you mean to change a variable name?
There was a problem hiding this comment.
{ lng: lng } equal { lng }
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks, I see.
There was a problem hiding this comment.
Learned new knowledge
src/main/services/i18n/index.ts
Outdated
| } | ||
| }) | ||
|
|
||
| // add language list here |
There was a problem hiding this comment.
I think we should remove this comment and just update https://github.com/massCodeIO/massCode/blob/master/src/main/services/i18n/locales/README.md
src/main/services/i18n/index.ts
Outdated
| }) | ||
|
|
||
| // add language list here | ||
| i18next.addResourceBundle('en', 'language', { |
There was a problem hiding this comment.
In general, the previous solution looked logical, although the current one works, since it will just be a fallback to en. I do not even know what is more correct )
There was a problem hiding this comment.
Did I misunderstand what you meant before? 😂
There was a problem hiding this comment.
I know exactly why it works, because there is a fallback to en if the selected locale has either no translation or no property at all.
I'm just confused which option to leave just. Because they both work.
There was a problem hiding this comment.
Let's keep the first option, because even without knowing the logic of i18n, it looks more logical
There was a problem hiding this comment.
OK, done.
My git usage is not very good, and the network with github also fluctuates. It took some time.
src/main/services/i18n/index.ts
Outdated
| i18next.use(Backend).init({ | ||
| fallbackLng: 'en', | ||
| lng: store.preferences.get('language'), | ||
| lng: lngset, |
There was a problem hiding this comment.
OK, I fix it myself. You need to read the basics of JS
There was a problem hiding this comment.
Oh I see. so awkward. I thought it was for code specification and to prevent ambiguity, so I changed the variable name.
I believe that participating in the project can learn a lot, please bear with me.

Uh oh!
There was an error while loading. Please reload this page.