-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Enable localization of notebook renderers #170919
Comments
My proposal is to expose the // Only showing new fields
export function activate(ctx: {
l10n: {
language: string, // For example, en-us
t(...) => string, // Localize function. Matches what we have in VSCode api
bundle: { ... } // Complete string bundle. Matches what we have in VSCode api
}
}) @TylerLeonhardt was also interested in seeing if we could make
|
Look into import maps: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
|
For #170919 This shows how we can use importmap to create an api that is specific to each renderer. This lets a renderer write: ```ts import * as vscode from 'vscode' ``` and get back a version of that api that is specific to that renderer, even though multiple different renderers may be running in the same notebook webview
New proposal using import maps: In notebook renderer: import * as vscode from `vscode-notebook-renderer`
...
vscode.l10n.t("My string") The shape of Unfortunately we likely can't ship this until import maps are also supported in mainline safari |
Actually we may be able to ship, but extensions would need to handle unsupported browsers themselves. Basically they would do: let vscode;
try {
vscode = await import('vscode-notebook-renderer')
} catch {
vscode = { l10n: { t(msg) { return msg } }}
} Since I expect few extensions to adopt l10n immediately and since Safari technical preview already supports import maps, this is likely an acceptable workaround until support lands in mainstream safari |
@mjbvz this changes the API from sync to async. Do we have top level await support? |
@TylerLeonhardt The api will still be sync, but the import is async. The should work using a top level |
Safari 16.4 added import maps support so we should be unblocked for all modern browsers. Tentatively assigning to June |
Tracks enabling localization for notebook renderer scripts. This work similarly to our existing extension localization support
The text was updated successfully, but these errors were encountered: