etcher icon indicating copy to clipboard operation
etcher copied to clipboard

minor: make i18n support and Chinese translation

Open RoderickQiu opened this issue 3 years ago • 19 comments

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.

RoderickQiu avatar Jul 21 '22 01:07 RoderickQiu

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)"
}

ghost avatar Jul 21 '22 01:07 ghost

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

RoderickQiu avatar Jul 21 '22 01:07 RoderickQiu

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.

mcraa avatar Jul 21 '22 06:07 mcraa

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

lurch avatar Jul 21 '22 08:07 lurch

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.

RoderickQiu avatar Jul 21 '22 15:07 RoderickQiu

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

lurch avatar Jul 21 '22 22:07 lurch

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.

图片

RoderickQiu avatar Jul 22 '22 02:07 RoderickQiu

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.

mcraa avatar Jul 22 '22 06:07 mcraa

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.

RoderickQiu avatar Jul 22 '22 13:07 RoderickQiu

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

RoderickQiu avatar Jul 22 '22 14:07 RoderickQiu

Awww :slightly_frowning_face: Screenshot from 2022-07-22 16-53-15

lurch avatar Jul 22 '22 15:07 lurch

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

mcraa avatar Jul 22 '22 16:07 mcraa

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.

RoderickQiu avatar Jul 23 '22 03:07 RoderickQiu

Yes @RoderickQiu, we will run it again

mcraa avatar Jul 25 '22 05:07 mcraa

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

RoderickQiu avatar Jul 27 '22 09:07 RoderickQiu

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 avatar Jul 27 '22 10:07 mcraa

@balena-ci test

mcraa avatar Jul 27 '22 10:07 mcraa

Hello, any update on this? Just asking.

RoderickQiu avatar Aug 25 '22 13:08 RoderickQiu

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 avatar Aug 26 '22 07:08 mcraa

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 avatar Nov 08 '22 18:11 ab77

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.

ab77 avatar Nov 10 '22 20:11 ab77

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 avatar Nov 11 '22 07:11 RoderickQiu

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

RoderickQiu avatar Nov 20 '22 15:11 RoderickQiu

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 avatar Nov 21 '22 16:11 mcraa

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 avatar Nov 21 '22 17:11 ab77

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

ab77 avatar Dec 05 '22 22:12 ab77

@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...

RoderickQiu avatar Dec 06 '22 03:12 RoderickQiu

@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.

ab77 avatar Dec 06 '22 14:12 ab77

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

RoderickQiu avatar Dec 12 '22 09:12 RoderickQiu

Replaced by https://github.com/balena-io/etcher/pull/3936

ab77 avatar Dec 12 '22 16:12 ab77