ReadonlylanguageThe host's display language, as a BCP 47 tag ('en', 'ja-JP', ...).
Formats a date for the display language.
Optionaloptions: DateFormatOptionsFormats a number for the display language.
Optionaloptions: NumberFormatOptionsPicks the plural form the display language calls for.
Optionalextra: Record<string, string | number>Formats a relative time for the display language.
Optionalstyle: "long" | "short" | "narrow"Translates a message, filling {0}, {1} from args.
Bind this service as l10n and the call reads l10n.t('...'), which is
the callee pattern @vscode/l10n-dev's string extractor scans for. The
shape is the contract: a bare t(...) cannot be found by that tool. For a
string the extractor absolutely must see, vscode.l10n.t directly is still
the safest option.
Translates a message carrying context for translators.
Everything an extension needs to show text in the user's language.
One service rather than a handful of free functions, because every member needs the same fact — the host's display language. Reading it separately in each call site is how a report ends up half in the user's language and half in someone else's, and the mismatch is invisible until it reaches a reader who notices. Here the language is resolved once, so every member agrees.
Formatting for an explicit locale — a webview, a log file, a bug report meant to be compared against another — is the
*Forfunctions in./format.js, which take the language and need no host at all.Example