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/OLoadNLSBundle- read and parsepackage.nls.jsonResolveNLSPlaceholdersInner- in-place recursive token substitution
Functions§
- LoadNLS
Bundle - Load an extension’s NLS bundle (
package.nls.json) into a{key → string}map. ReturnsNoneif absent or unreadable - placeholders remain as-is. Entries can be bare strings or{message, comment}objects; onlymessageis kept. ThePlaceholdersNeededflag downgrades the “no bundle” warning when the manifest has no%placeholder%entries (absence is benign). - Manifest
ContainsNLS Placeholders - Return
trueifValuecontains any%placeholder%token anywhere in the tree. Used to skip bundle I/O for manifests that have no tokens. - ResolveNLS
Placeholders Inner - In-place recursive substitution of
%key%tokens using the NLS map.ReplacedandUnresolvedaccumulate counts for the outer scanner’s one-line summary log.