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

minor: make i18n support and Chinese translation #3790

Closed
wants to merge 10 commits into from

Conversation

RoderickQiu
Copy link
Contributor

@RoderickQiu RoderickQiu commented Jul 21, 2022

Add the long-wanted i18n support using i18next, fixed #308 and fixed #3692.
Tested on macOS 12 and it's been running fluently.

Example (zh-CN on macOS):
图片

It works generally fine and has support for more languages, as shown in this markdown.

However, there are few problems:

  • I cannot find the method to change several "cancel" buttons' captain text.

图片

  • When flashing/finished, a webview is shown and I cannot change that.

图片

图片

I sincerely hope that my pull request can be merged.

- make i18n using i18next
- add Chinese (Simplified) support
- split translations from i18n.ts to several .ts files in lib/gui/app/i18n
- make a README for new language changes
- add zh-TW instead of only zh-CN
@ghost
Copy link

ghost commented Jul 21, 2022

An error occurred whilst building your landr site preview:

{
  "name": "Error",
  "message": "Command failed with code undefined: /usr/src/app/node_modules/gatsby/cli.js build",
  "stack": "Error: Command failed with code undefined: /usr/src/app/node_modules/gatsby/cli.js build\n    at Object.exports.run (/usr/src/app/lib/build-runner.js:257:11)\n    at async build (/usr/src/app/bot/index.js:132:19)\n    at async /usr/src/app/bot/index.js:210:25\n    at async Promise.all (index 0)\n    at async middleware (/usr/src/app/node_modules/@octokit/webhooks/dist-node/index.js:355:5)"
}

@RoderickQiu
Copy link
Contributor Author

@mcraa @lurch I don't understand why landrbot and versionbot failed?? The error message is hard to be understood.

@mcraa
Copy link
Contributor

mcraa commented Jul 21, 2022

Thanks, nice work @RoderickQiu

why the check fails is described here and here, the change-type is missing.
starting with for eg. patch: instead of feat: or adding Change-Type: patch at the end should do the trick.

@lurch
Copy link
Contributor

lurch commented Jul 21, 2022

@RoderickQiu Whilst I still occasionally comment on some of the issues, I no longer have anything to do with the Etcher project 🙂
But having worked on other localisation projects before, this indeed looks like impressive work!

lib/shared/messages.ts Outdated Show resolved Hide resolved
@RoderickQiu RoderickQiu changed the title feat: make i18n support and Chinese translation minor: make i18n support and Chinese translation Jul 21, 2022
Optimized several translations.
This commit itself is only a patch, but as a pull request must have at least one commit with a change-type.

Change-Type: minor
lib/shared/messages.ts Outdated Show resolved Hide resolved
lib/shared/messages.ts Outdated Show resolved Hide resolved
lib/shared/messages.ts Outdated Show resolved Hide resolved
more direct string-concatenation, thanks to @lurch
@RoderickQiu
Copy link
Contributor Author

Translations should have all been corrected. I'm going to sleep now. Things for tomorrow~
However, on last commit, it says ResinCI/electron failed but the log kept
图片
And I don't know what happened. On my mac it works flawlessly.

@lurch
Copy link
Contributor

lurch commented Jul 21, 2022

Yeah unfortunately I believe the ResinCI logs are only viewable by Balena employees? 🤷 ("Resin" is what "Balena" used to be called https://www.balena.io/blog/resin-io-changes-name-to-balena-releases-open-source-edition/ ).

flashSucceed_other: 'Successful targets',
flashFail_one: 'Failed target',
flashFail_other: 'Failed targets',
to: 'to ',
Copy link
Contributor

Choose a reason for hiding this comment

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

With the recent changes, I think message.to and message.target are now unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you are right. Will delete them later.

@RoderickQiu
Copy link
Contributor Author

RoderickQiu commented Jul 22, 2022

Yeah unfortunately I believe the ResinCI logs are only viewable by Balena employees? 🤷 ("Resin" is what "Balena" used to be called https://www.balena.io/blog/resin-io-changes-name-to-balena-releases-open-source-edition/ ).

Ahh...So how can I contact a balena employee? Those public members of balena github team doesn't seem to be connected with etcher project?? Could you help @mcraa you seems like an active maintainer, thanks.

图片

@mcraa
Copy link
Contributor

mcraa commented Jul 22, 2022

Don't worry @RoderickQiu

the CI is not that reliable sometimes the upload fails after a successful build sometimes the worker does not start.
but this time it is not the CI's fault, something is missing in the new feature,
all platforms failed during running the test-gui script.

TypeError: Cannot read property 'use' of undefined
    at Object.<anonymous> ([...]/lib/gui/app/i18n.ts:23:9)
    at Object.<anonymous> ([...]/lib/gui/app/i18n.ts:39:3) 

I hope you can reproduce it, otherwise I will have a look later.

@RoderickQiu
Copy link
Contributor Author

RoderickQiu commented Jul 22, 2022

Don't worry @RoderickQiu

the CI is not that reliable sometimes the upload fails after a successful build sometimes the worker does not start. but this time it is not the CI's fault, something is missing in the new feature, all platforms failed during running the test-gui script.

TypeError: Cannot read property 'use' of undefined
    at Object.<anonymous> ([...]/lib/gui/app/i18n.ts:23:9)
    at Object.<anonymous> ([...]/lib/gui/app/i18n.ts:39:3) 

I hope you can reproduce it, otherwise I will have a look later.

Oh yeah I ran that script and it showed that type-error. This problem really seems weird, might be a problem of i18next or the CI itself??

But surprisingly, by changing all the import i18next from 'i18next;' (which was suggested by i18next) to import * as i18next from 'i18next'; the test is now working (the app itself works both before and after the change), although I really don't know why is that. Could you explain that?? (I've never used mocha myself, so it might be hard for me to understand it at first, really..)

However, as the test script itself is not i18n-ed now, some asserts are failing. But I'm sure that could be solved soon.

- use `import * as i18next from 'i18next';` instead of `import i18next from 'i18next';` and add an specific env to bypass mocha test
- optimized several translations
lib/gui/app/i18n/en.ts Outdated Show resolved Hide resolved
according to a suggestion of @lurch
@RoderickQiu
Copy link
Contributor Author

图片

Yay so before this minor commit everything was already fine and will surely be after it~ Just very good.

@lurch
Copy link
Contributor

lurch commented Jul 22, 2022

Awww 🙁
Screenshot from 2022-07-22 16-53-15

@mcraa
Copy link
Contributor

mcraa commented Jul 22, 2022

The build was ok, just the upload failed at the end.

@RoderickQiu
Copy link
Contributor Author

The build was ok, just the upload failed at the end.

So what can I do? Or can you perform a retest @mcraa ? Thanks. A minor change like this shouldn't break anything.

@mcraa
Copy link
Contributor

mcraa commented Jul 25, 2022

Yes @RoderickQiu, we will run it again

@RoderickQiu
Copy link
Contributor Author

Hello, any update on this? Does it means that I should push a blank commit to let it mergeable again?

@mcraa
Copy link
Contributor

mcraa commented Jul 27, 2022

No @RoderickQiu, you are good.
Even if the CI succeeds I want to run your changes locally, which I haven't had time for yet.

@mcraa
Copy link
Contributor

mcraa commented Jul 27, 2022

@balena-ci test

@RoderickQiu
Copy link
Contributor Author

Hello, any update on this? Just asking.

@mcraa
Copy link
Contributor

mcraa commented Aug 26, 2022

Hi, sorry for this taking so long.
Quite some stuff slipped to the priority list before this.
I can assure you it is not forgotten.

@ab77
Copy link
Contributor

ab77 commented Nov 8, 2022

Hi, sorry for this taking so long. Quite some stuff slipped to the priority list before this. I can assure you it is not forgotten.

@mcraa @builder555 @zwhitchcox any of you folks have any bandwidth to get this over the line? Looks like an extremely valuable contribution...

@ab77
Copy link
Contributor

ab77 commented Nov 10, 2022

Hello, any update on this? Just asking.

@RoderickQiu hello, thanks for you patience. Could you please rebase on master and resolve a couple of conflicts to get this over the line.

@RoderickQiu
Copy link
Contributor Author

Hello, glad to see some conversation again. However, I've been quite busy lately and I hope I can be freer next week to do some stuff.

@RoderickQiu
Copy link
Contributor Author

OK, I finally remembered to finish the conflict resolve task! @mcraa @ab77

@mcraa
Copy link
Contributor

mcraa commented Nov 21, 2022

Currently, the new CI does not work well with PRs from external repos (security reasons).
ab77 is working on it, to enable great contributions like this one.
If it is not fixed soon, I will merge it to a temporary branch then the CI should merge it to master.

@ab77
Copy link
Contributor

ab77 commented Nov 21, 2022

Currently, the new CI does not work well with PRs from external repos (security reasons). ab77 is working on it, to enable great contributions like this one. If it is not fixed soon, I will merge it to a temporary branch then the CI should merge it to master.

@mcraa you should go ahead and do that anyway as external contributor flow may take a while (it's not trivial).

@ab77
Copy link
Contributor

ab77 commented Dec 5, 2022

@mcraa external contributor support has shipped, so @RoderickQiu can now rebase, resolve conflicts and hopefully push one last time.

@RoderickQiu
Copy link
Contributor Author

@mcraa external contributor support has shipped, so @RoderickQiu can now rebase, resolve conflicts and hopefully push one last time.

OK, but sadly I just directly went forward for a merge... And of course it failed and it seems that I cannot revert it...

@ab77
Copy link
Contributor

ab77 commented Dec 6, 2022

@mcraa external contributor support has shipped, so @RoderickQiu can now rebase, resolve conflicts and hopefully push one last time.

OK, but sadly I just directly went forward for a merge... And of course it failed and it seems that I cannot revert it...

Please rebase on master. there shouldn't be any modifications of files under .github/ in this PR.

@RoderickQiu
Copy link
Contributor Author

Sorry for my delay, but I've never done a rebase and failed to do this on the master. I had a second try just for now. After a unsuccessful attempt which again turned out to be a merge, I finally realized the way to make a rebase. However, after the rebase it seems that every commit come to co-assign with my name... Is that normal to have this?

Please, have a look at https://github.com/RoderickQiu/etcher/tree/i18n-conflict-resolve-2 and if it's satisfying, I will open a new pull request base on that branch. Or if I am messing up things, please tell me because I've never done that. @ab77

@ab77 ab77 mentioned this pull request Dec 12, 2022
@ab77
Copy link
Contributor

ab77 commented Dec 12, 2022

Replaced by #3936

@ab77 ab77 closed this Dec 12, 2022
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.

Etcher - can't change the language - HOW can i change the interface language ? internationalization (i18n)
4 participants