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

Document the use of vscode-nls with webpack #483

Closed
PeterWone opened this issue Aug 30, 2021 · 2 comments
Closed

Document the use of vscode-nls with webpack #483

PeterWone opened this issue Aug 30, 2021 · 2 comments
Assignees

Comments

@PeterWone
Copy link

The point of difficulty is in-code use of localize for constructing localised messages.

The question has been raised on Stack Overflow but here are some more details.
In the absence of webpack a trace into this call

const localize = nls.config({ messageFormat: nls.MessageFormat.file })();

reveals that the loader passes a filepath to loadMessageBundle(file)

With webpack this the parameter is undefined. The consequence of this is that things are initialised differently, so a different method is called when I invoke localize, and the default value (the second string parameter passed to localize) is always returned.

Breakpointing the start of loadMessageBundle(file) in an extension that is not bundled (the vscode-nls sample) allows a look at the call stack. The call stack eventually disappears into helper.js inside node.

With webpack in play, the value of this parameter is undefined.

I suspect the problem is that the files generated into the out folder by gulp build are not bundled. They don't even exist in the source so they can't be referenced statically. I have no idea how to convince webpack to include them, or whether this is the whole of the problem.

@dbaeumer dbaeumer transferred this issue from microsoft/vscode-docs Aug 31, 2021
@dbaeumer
Copy link
Member

We should add an example demonstrating how this works.

@TylerLeonhardt
Copy link
Member

vscode-nls is deprecated in favor of http://github.com/microsoft/vscode-l10n so closing this.

@TylerLeonhardt TylerLeonhardt closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants