translate.map()
The translate.map() function translates flatten $map with a global dictionary and/or $dictionary.
// Sass.
@use 'sass:map';
@use 'sass:meta';
// Modules.
@use '../dictionary';
// Functions.
@use 'translate.list.function' as *;
@use 'translate.string.function' as *;
// The `translator.translate-map()` or `translate.map()` function.
@function map($map, $key: null, $dictionary: (), $global: null) {
@if type-of($map) == map {
@each $map-key, $value in $map {
$map: if(
meta.type-of($value) == string,
map.set($map, $map-key, string($value, $key, $dictionary, $global)),
if(
meta.type-of($value) == list,
map.set($map, $map-key, list($value, $key, $dictionary, $global)),
$map
)
);
}
}
@return $map;
}https://github.com/angular-package/sass/blob/main/translator/translate/_translate.map.function.scss
Parameters
$map
$mapA list in which element at given $n index is translated.
$n
$nAn index of $list to translate.
$key: null
$key: nullA key of the dictionary retrieved from a global and/or given $dictionary.
$dictionary: ()
$dictionary: ()The dictionary that is used to translate $n element in $list.
$global: null
$global: nullA bool value indicates whether to use a global dictionary. Default, null, then $dictionary-global is checked.
Return
The return value is the list with a translated $n element of $list.
Examples
Last updated
Was this helpful?