translate.string()
The translate.string() function returns a translated $string with a global dictionary(if in use) and/or $dictionary if translation is found, otherwise not translated $string.
// Functions.
@use '../translator.dictionary.function';
// Modules.
@use '../dictionary';
// The `translator.translate-string()` or `translate.string()` function.
@function string($string, $key: null, $dictionary: (), $global: null) {
@return if(
type-of($string) == string,
dictionary.translation(
$string,
translator.dictionary($key, $dictionary, $global)
)
or $string,
$string
);
}https://github.com/angular-package/sass/blob/main/translator/translate/_translate.string.function.scss
Parameters
$string
$stringA string to translate with a global dictionary and/or $dictionary.
$key: null
$key: nullA key to retrieve the dictionary from a global(if in use) and/or $dictionary.
$dictionary: ()
$dictionary: ()The dictionary that is used to translate $string.
$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 translated $string retrieved from a global dictionary(if in use) and/or $dictionary.
Examples
Last updated
Was this helpful?