You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The l10n sample is great, and I'm trying to incorporate it into an extension. I'm wondering how to integrate the l10n API into a webview. I would like to suggest adding a webview to the l10n-sample, or otherwise to add a new sample specifically for webview-l10n
The text was updated successfully, but these errors were encountered:
I also had a question related to this topic. If I build my webviews using Webpack, would I be able to use the @vscode/l10n library from within the webview code, making calls to l10n.t() from within there?
In that post, the author recommends sending over the contents of vscode.l10n.uri?.fsPath from the extension to the webview via postMessage. Is that the recommended way to proceed? I'm worried that postMessage would be slow to send so many strings, especially considering that all strings would go to all webviews, even if the webview only requires a subset of the strings.
I also wonder if I could directly access the localization file from the webview using Webview.asWebviewUri, which could be more performant than the postMessage approach.
I would say at this time, there is no "recommended" way to do this. We want to light up localization for webviews in a more supported way... That's tracked here: microsoft/vscode#170919 (Notebook renderers are a form of webview)
Leveraging @vscode/l10n is certainly an option as you could:
send over vscode.l10n.uri
do await l10n.config({ uri: thatUriString })
The other option, which I think is more common, is to localize your strings in the extension host, and then send them over to the webview localized. You can do this in many different ways.
The l10n sample is great, and I'm trying to incorporate it into an extension. I'm wondering how to integrate the l10n API into a webview. I would like to suggest adding a webview to the l10n-sample, or otherwise to add a new sample specifically for webview-l10n
The text was updated successfully, but these errors were encountered: