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

Localize plugins using language packs #10087

Merged
merged 1 commit into from
Oct 21, 2021
Merged

Localize plugins using language packs #10087

merged 1 commit into from
Oct 21, 2021

Conversation

msujew
Copy link
Member

@msujew msujew commented Sep 12, 2021

What it does

Addresses one of the open issues of #9538: Enables Theia to localize vscode extensions/plugins using language packs.

Basically addresses two problems regarding vscode extensions:

First off, it changes how the plugin package is read. Placeholders are now replaced when the frontend loads and not when the plugin is deployed.

Secondly, through reverse engineering of the vscode-nls module, we are able to create translationConfig files that point to the correct localization file for each vscode extension. These files are cached in the localization-cache folder in the Theia home directory.

How to test

  1. Install the vscode.npm builtin extension and a language pack of your liking.
  2. Verify that the npm Scripts view is visible and in english.
  3. Open a package.json file that contains a scripts section. Hover over one of the scripts and observe the Run Script popup:
    image
  4. Use the Configure Display Language command to change to a different language.
  5. The application reloads and the npm Scripts view should now have a different name. (Tests that the package.json is still correctly translated)
  6. Hover over one of the scripts from the package.json file and observe a changed popup. (Tests that the plugin host runtime is using the correct localization)
    image

Review checklist

Reminder for reviewers

@msujew msujew added localization issues related to localization/internalization/nls vscode issues related to VSCode compatibility labels Sep 12, 2021
@msujew msujew force-pushed the msujew/extension-i18n branch from 7a5071c to da48301 Compare September 13, 2021 09:13
@tsmaeder
Copy link
Contributor

@msujew one of the problems I see is that we're assuming that plugins are deployed at the back end, not the plugin host. I think this prevents us from doing stuff like remote workspaces, as VS Code does. I think just using the packageUri field instead of packagePath and using the FileService instead of node file system should get us there.

@tsmaeder
Copy link
Contributor

Also: could you open an epic with problems you know that need solving with NLS? Would be good to be able to track the state of the implementation.

@msujew msujew mentioned this pull request Sep 29, 2021
8 tasks
@msujew
Copy link
Member Author

msujew commented Sep 29, 2021

Could you open an epic with problems you know that need solving with NLS?

Sure, done #10188

One of the problems I see is that we're assuming that plugins are deployed at the back end, not the plugin host.

I'm not sure I can follow. Can the plugin host be deployed to other resources (which do not have access to the file system of the backend) using remote workspaces? The issue is that the extensions/plugins internally try (using the vscode-nls package) to read the translation files using the same file system where the language pack was installed.

Copy link
Contributor

@jbicker jbicker left a comment

Choose a reason for hiding this comment

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

Works as described! Great work!

@msujew msujew force-pushed the msujew/extension-i18n branch from da48301 to 4ad6514 Compare October 21, 2021 16:46
@msujew msujew force-pushed the msujew/extension-i18n branch from 4ad6514 to 4dda178 Compare October 21, 2021 17:22
@msujew
Copy link
Member Author

msujew commented Oct 21, 2021

@tsmaeder FYI, I will come back to the remote plugin host issue later, in another PR. I'll merge this for now.

@msujew msujew merged commit 4ba6752 into master Oct 21, 2021
@github-actions github-actions bot added this to the 1.19.0 milestone Oct 21, 2021
@msujew msujew deleted the msujew/extension-i18n branch October 21, 2021 18:01
@msujew msujew mentioned this pull request Feb 23, 2023
1 task
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 vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants