// Variables.
@forward 'dictionary.variables';
@use 'dictionary.variables' as variables;
// Modules.
@use '../../../map';
// The `translator.dictionary-get()` or `dictionary.get()` function.
@function get($key: null, $default: null) {
@return if(
$key,
if(
type-of(map.get(variables.$dictionary, $key)) == map,
map.get(variables.$dictionary, $key),
$default
),
variables.$dictionary
);
}
// Use.
@use '@angular-package/sass/translator';
// Examples.
// Gets the global dictionary
@debug translator.dictionary-get(); // (word: translation)
// Gets the global dictionary of key (not translation)
@debug translator.dictionary-get(word); // null
// Gets nested key
variables.$dictionary: map.merge(variables.$dictionary, (test: (ok: (first: accept, second: do))));
@debug translator.dictionary-get((test, ok)); // (first: accept, second: do)
@debug translator.dictionary-get((word, wrong)); // null
// Gets the `$default`
@debug translator.dictionary-get(word, exist); // exist