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

Wait for plugins to deploy before restoring the current language #11472

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

AlbyIanna
Copy link
Contributor

@AlbyIanna AlbyIanna commented Jul 27, 2022

What it does

Wait for the plugins to be deployed before restoring the current language.

Fixes #11471

How to test

  • Open IDE select de as the default
  • IDE reloads, it shows de
  • Quit IDE
  • Start IDE, it still shows de
  • Select zh-cn as the default language
  • IDE reloads and shows zh-cn
  • Quit IDE
  • Open IDE
  • The language is still zh-cn

Review checklist

Reminder for reviewers

@AlbyIanna AlbyIanna changed the title get all available languages when restoring the current language Get all available languages when restoring the current language Jul 27, 2022
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution 👍

In order to accept your changes please be sure to sure to sign the eclipse contributor agreement (eca) with the same email as your authorship.

Please also be sure to properly fill out the original pull-request template.

@vince-fugnitto vince-fugnitto added the localization issues related to localization/internalization/nls label Jul 27, 2022
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

I'm not sure that this is the right way to go about this, since it doesn't actually resolve the issue. When getting all available languages, including those which don't have language packs loaded, we will definitely have to deal with the problem of 90% of Theia not being translated.

As far as I can tell this is a race condition, right? So instead, the express endpoint should await the plugin loading process, where all language packs are loaded into memory. This should be done fairly quickly without impacting the load time on Electron.

I can probably contribute a fix for this within the next few days.

@AlbyIanna
Copy link
Contributor Author

we will definitely have to deal with the problem of 90% of Theia not being translated.

This would be true only during the loading time, right?

But yes, I would go for the other solution too, I just couldn't find a way to await for the languages loading process. Probably I've just didn't dig deep enough (and also didn't know how waiting for it would affect the Theia loading time)

@msujew
Copy link
Member

msujew commented Jul 27, 2022

This would be true only during the loading time, right?

Yes, but that's the issue. We already load translations during loading time. The /i18n/:locale endpoint not only returns metadata on languages, but all of the translations as well, since they need to be available at the time of loading the JS code.

@AlbyIanna
Copy link
Contributor Author

@msujew I see. Thanks for the tip, I think I've found a better solution here

if you like it, I'd gladly update this PR with that code.

@msujew
Copy link
Member

msujew commented Jul 29, 2022

@AlbyIanna Sure, something similar should work for the Theia codebase as well 👍

Don't forget to sign the ECA by the way.

@AlbyIanna AlbyIanna changed the title Get all available languages when restoring the current language Wait for plugins deploy before restoring the current language Aug 1, 2022
@AlbyIanna AlbyIanna changed the title Wait for plugins deploy before restoring the current language Wait for plugins to deploy before restoring the current language Aug 1, 2022
@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from 1c33a9e to af1e63f Compare August 1, 2022 07:22
@AlbyIanna
Copy link
Contributor Author

@msujew done 👌

@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from 1c2a946 to dd1c8d8 Compare August 1, 2022 07:27
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

@AlbyIanna With "something similar" I didn't mean the exact same approach ;) Given our architecture, you can't simply import code from the plugin-ext package into the core package. You'll have to create a dedicated override in the plugin-ext package for the LocalizationBackendContribution and bind it there.

Also we can't accept your changes when you haven't signed the ECA. Please do so.

@AlbyIanna
Copy link
Contributor Author

You'll have to create a dedicated override in the plugin-ext package for the LocalizationBackendContribution and bind it there.

@msujew I'm not sure how to proceed here. Could you please provide me with an example of how to do that?

Also we can't accept your changes when you haven't signed the ECA. Please do so.

I should have done it now. Can you please confirm I did it right?

@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from dd1c8d8 to af13193 Compare August 1, 2022 09:45
@msujew
Copy link
Member

msujew commented Aug 1, 2022

I'm not sure how to proceed here. Could you please provide me with an example of how to do that?

Sure, I recently did something similar: There is a core LanguageQuickPickService, which is overriden in the vsx-registry package as VSXLanguageQuickPickService as the services in there aren't available in core.

I should have done it now. Can you please confirm I did it right?

Are you sure you did it with the mail that's in the commit? It doesn't seem to validate.

image

@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from af13193 to a664a95 Compare August 1, 2022 11:05
@AlbyIanna
Copy link
Contributor Author

Are you sure you did it with the mail that's in the commit? It doesn't seem to validate.

Yes, I'm sure about it because I received the confirmation e-mail after the registration.

This is what I see in my Eclipse Account:
image

@msujew
Copy link
Member

msujew commented Aug 1, 2022

Yes, I'm sure about it because I received the confirmation e-mail after the registration.

Alright, cool. It seems to work now. No idea why it didn't work previously.

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

There are a few linting errors across the changes. You should probably enable the ESLint vscode extension so you can catch those during development.

@AlbyIanna
Copy link
Contributor Author

@msujew thanks for the feedback. In the last commit I've made some changes according to your requests 👍

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Great, just one change and this should be good to go 👍

Also, just for completeness' sake, do you mind filling out the PR template?

@msujew
Copy link
Member

msujew commented Aug 11, 2022

@AlbyIanna Are you still interested in contributing the changes? I still have a few outstanding comments before approving this.

@AlbyIanna
Copy link
Contributor Author

Hi @msujew, thanks for the review. Sorry for the delay in answering, I must have missed the notification 🙏
I will address your remarks soon.

@AlbyIanna AlbyIanna requested a review from msujew August 11, 2022 15:53
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

The changes look good to me 👍

Please address the linting issues (see below) and then I'll merge this.

@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from 6044ff3 to 2b64b48 Compare August 16, 2022 07:35
@AlbyIanna AlbyIanna force-pushed the fix-current-language branch from 2b64b48 to 452eca6 Compare August 16, 2022 12:37
@msujew msujew merged commit fa4a9cf into eclipse-theia:master Aug 17, 2022
@AlbyIanna AlbyIanna deleted the fix-current-language branch August 17, 2022 11:59
@vince-fugnitto vince-fugnitto added this to the 1.29.0 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
localization issues related to localization/internalization/nls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restoring current language might fail at start-up
3 participants