-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support for vscode l10n
API
#12192
Support for vscode l10n
API
#12192
Conversation
@msujew I was finding the documentation on the new way of localizing things a bit sparse in https://code.visualstudio.com/api/references/vscode-api#l10n. Did you have any other sources when implementing this? |
Just imagine the fun I had when I had to reverse-engineer the But to answer the question: No, it's mostly based on reverse engineering sources of vscode and the JSON files that are the deliverables of the language packs. |
@msujew since the test suite has been "deflaked" recently, could you rebase to see if the suite passes? |
32e76a5
to
251d4fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First reading of the code.
packages/plugin-ext/src/hosted/node/hosted-plugin-localization-service.ts
Show resolved
Hide resolved
packages/plugin-ext/src/hosted/node/hosted-plugin-localization-service.ts
Show resolved
Hide resolved
packages/plugin-ext/src/hosted/node/hosted-plugin-localization-service.ts
Show resolved
Hide resolved
packages/plugin-ext/src/hosted/node/hosted-plugin-localization-service.ts
Show resolved
Hide resolved
251d4fd
to
69091ee
Compare
When I execute step 1.iii in your testing instructions, I get a stack trace in the back end console:
|
Hovering over a selector never shows a hover for me: instead I see "Activating CSS Sprachfeatures" in the status bar and the "busy"-indicator keeps rotating. |
@tsmaeder This extension code snippet probably isn't doing what it's supposed to do. It seems like Anyway, the test step is ultimately just to prove that the API yields |
Yes I did. I'm willing to believe that there is a caching problem with exploded extensions, though. Lemme check. |
Nope, this is not working for me: I do get the hover with "Selector Specificity" when the language is English, but I don't get a hover at all when the language is German. |
@tsmaeder The CSS extension exhibited some weird race condition when using a non-english locale. I've fixed the race condition, please download the new version to test it :) |
I can reproduce the issue experienced by @tsmaeder both on Electron and browser: The source of the issue is the old node version used in Electron. We currently use 16.5.0, which exhibits some unexpected behavior in regards to event emitters on processes. Using node > 16.14.0 (or upgrading Electron) fixes the issue. |
@msujew to make this clear: with the current set of built-ins, we should be fine, right? Can you tell which version of the built-ins would start misbehaving (giving us a deadline for updating electron)? |
@tsmaeder The same version that this API has been released with, 1.73.0. |
@msujew if I understand correctly, there is nothing holding us back from merging this PR (except an approval), right? The trick is not to update the VS Code API level, right? |
@tsmaeder Yep, that's right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased on master and tested with electron and now the tests related to css files work for me.
4cc5603
to
010ccaf
Compare
What it does
Closes #11893
VSCode 1.73 not only brought the new
l10n
namespace with it, but also changed the way language packs for vscode built-ins work. Theia now supports both old and new language packs and extension localization APIs (l10n
andvscode-nls
).How to test
You will need 4 extensions to test this feature:
l10n-test
and execute thel10n:*
commands.Hello World
command will create a notification with"Hello World!"
Show URI
command will showUNDEFINED
Show Bundle
command will also show undefined.German/de
l10n
, the command names are localized)Hello World
command will create a notification with"Hallo Welt!"
Show URI
command will show the file uri to the German language bundle of thel10n-test
extensionShow Bundle
command will display a JSON containing the language bundle contentcss-language-features
extensioncss
andcss-language-features
extensions.Selektorspezifität
(German) instead ofSelector Specificity
(English) in the hover. This step asserts that extensions can still be localized using language packs.Also make sure to test for regressions with existing language pack functionality:
typescript-language-features
extension)Review checklist
Reminder for reviewers