microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.38k stars 29.32k forks source link

`Extension Host (Worker)` isn't localized #192808

Open TylerLeonhardt opened 1 year ago

TylerLeonhardt commented 1 year ago
image

The localize call: https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/workbench/api/common/extHostLogService.ts#L21

The webworker one is weird... because there isn't a concept of env vars so VSCODE_NLS_CONFIG isn't a thing in the web like it is in node and is used to configure the REH AMD Loader: https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/server/node/extensionHostConnection.ts#L46

I'm not seeing us configure the AMD loader with the language which is why that one isn't working.

https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/base/worker/workerMain.ts#L67

Originally posted by @TylerLeonhardt in https://github.com/microsoft/vscode/issues/192787#issuecomment-1714395217

yiliang114 commented 11 months ago
image

The localize call:

https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/workbench/api/common/extHostLogService.ts#L21

The webworker one is weird... because there isn't a concept of env vars so VSCODE_NLS_CONFIG isn't a thing in the web like it is in node and is used to configure the REH AMD Loader:

https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/server/node/extensionHostConnection.ts#L46

I'm not seeing us configure the AMD loader with the language which is why that one isn't working.

https://github.com/microsoft/vscode/blob/ba3978f8658ec5048d7d09c41016747ac997358b/src/vs/base/worker/workerMain.ts#L67

Originally posted by @TylerLeonhardt in #192787 (comment)

After getting the current language in html, pass it to worker when initializing it. Is it OK? AMDLoader in other places needs to pass other attributes such as supported languages, but here only the current language may be enough, because the page or application will be refreshed when switching languages.

TylerLeonhardt commented 11 months ago

That might do the trick... this is specifically talking about Core strings that exist in the webworker that need to be localized... in other words, not strings inside of an extension, for example.