dictionary.set()

The dictionary.set() function sets the $value under the $key in a global dictionary.

// Variables.
@forward 'dictionary.variables';
@use 'dictionary.variables' as variables;

// Modules.
@use '../../map';

// The `translator.dictionary-set()` or `dictionary.set()` function.
@function set($key, $value) {
  variables.$dictionary: map.set(variables.$dictionary, $key, $value);
  @return variables.$dictionary;
}

Parameters

$key

A key under which $value is set in a global dictionary.

$value

A value to set under the $key of global dictionary.

Return

The return value is a global dictionary with updated $value in the $key.

Examples

// Use.
@use '@angular-package/sass/translator';

// Examples.
$-dictionary: (
  general: (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c),
  class: (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab)),
  prefix: spectre,
  border: b,
  color: c,
  separator: '-',
  suffix: end,
  outline: o,
  var: (prefix: var-prefix, suffix: var-suffix),
);

// Examples.
// Sets translation of `small` as `sm`
@debug translator.dictionary-set(small, sm); // (word: translation, small: sm)

// Sets the `class` dictionary
@debug translator.dictionary-set(class, map.get($-dictionary, class)); // (word: translation, small: sm, class: (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab)))

Last updated