Skip to main content

Module NLSResolver

Expand description

NLS (National Language Support) placeholder resolution for extension manifests. VS Code extensions embed %key% tokens in their package.json that are resolved at runtime from a package.nls.json bundle.

Three functions work together:

  • ManifestContainsNLSPlaceholders - fast pre-scan to skip bundle I/O
  • LoadNLSBundle - read and parse package.nls.json
  • ResolveNLSPlaceholdersInner - in-place recursive token substitution

Functions§

LoadNLSBundle
Load an extension’s NLS bundle (package.nls.json) into a {key → string} map. Returns None if absent or unreadable - placeholders remain as-is. Entries can be bare strings or {message, comment} objects; only message is kept. The PlaceholdersNeeded flag downgrades the “no bundle” warning when the manifest has no %placeholder% entries (absence is benign).
ManifestContainsNLSPlaceholders
Return true if Value contains any %placeholder% token anywhere in the tree. Used to skip bundle I/O for manifests that have no tokens.
ResolveNLSPlaceholdersInner
In-place recursive substitution of %key% tokens using the NLS map. Replaced and Unresolved accumulate counts for the outer scanner’s one-line summary log.