translator.translate()
The translator.translate() function translates list, map, or string with a global dictionary, optionally with a dictionary of $keys.
// Sass.
@use 'sass:list';
@use 'sass:map';
@use 'sass:meta';
// Functions.
@use 'translator.dictionary.function';
// Modules.
@use 'dictionary';
@use 'translate';
// The `translator.translate()` function.
@function translate($words, $keys...) {
@return meta.call(map.get((
list: meta.get-function(list, false, translate),
map: meta.get-function(map, false, translate),
string: meta.get-function(string, false, translate),
),
meta.type-of($words)),
$words,
$keys...
);
}https://github.com/angular-package/sass/blob/main/translator/_translator.translate.function.scss
Parameters
$words
$wordsThe words in list, map, or string to translate.
$keys...
$keys...Keys of the dictionaries that are used to translate $words.
Return
The return value is the translated list, map, or string depending on the given $words.
Examples
Translate string
stringTranslates string with a dictionary general.
Translate list
listTranslates list with a dictionary general.
Translate map
mapNested key
Translates string with a nested dictionary.
Last updated
Was this helpful?