dictionary.translation()

The dictionary.translation() function returns a translation of $search from a global dictionary, $dictionary, and $dictionaries.

// Sass.
@use 'sass:list';

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

// Functions.
@use '../../../values';

// The `translator.dictionary-translation()` or `dictionary.translation()`
@function translation($search, $dictionary: (), $dictionaries...) {
  @each $dictionary in values.combine($dictionary, $dictionaries) {
    @each $phrase, $translation in $dictionary {
      @if list.index($phrase, $search) and $translation {
        @return $translation;
      }
    }
  }
  @return null;
}

Parameters

$search

A word(string) or phrase(list space separated) to search for translation.

$dictionary

Additional dictionary to look for $search translation.

$dictionaries...

Dictionaries to look for $search translation.

Return

The return value is a translation of the $search.

Examples

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

// Examples.

Last updated