Namespace for localization-related functionality in the extension API. To use this properly,
you must have l10n
defined in your extension manifest and have bundle.l10n.
Note: Built-in extensions (for example, Git, TypeScript Language Features, GitHub Authentication)
are excluded from the l10n
property requirement. In other words, they do not need to specify
a l10n
in the extension manifest because their translated strings come from Language Packs.
Variables
finalbundle:Null<DynamicAccess<String>>
The bundle of localized strings that have been loaded for the extension. It's undefined if no bundle has been loaded. The bundle is typically not loaded if there was no bundle found or when we are running with the default language.
Methods
t(message:String, args:Rest<Array<EitherType<String, EitherType<Float, EitherType<Int, Bool>>>>>):String
t(options:{message:String, comment:EitherType<String, Array<String>>, args:Null<EitherType<Array<EitherType<String, EitherType<Float, EitherType<Int, Bool>>>>, Record<String, Any>>>}):String
t(message:String, args:Record<String, Any>):String
Marks a string for localization. If a localized bundle is available for the language specified by {@link env.language} and the bundle has a localized value for this message, then that localized value will be returned (with injected {@link args} values for any templated values).
@link args} array. @example l10n.t('Hello {0}!', 'World');
Parameters:
message |
|
---|---|
args |
|
Returns:
localized string with injected arguments.