> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary/dictionary.pick.md).

# dictionary.pick()

The `dictionary.pick()` function returns the dictionary from a global dictionary(if in use) and multiple [`$dictionary`](#usddictionary) associated with [`$key`](#usdkey).

{% hint style="info" %}
Global dictionary is in use on [`$dictionary-global`](/sass/translator-v0.1.0/dictionary/dictionary.variables.md#usddictionary-global-true) set to `true`, or by setting [`$global`](#usdglobal-null) argument to `true`.
{% endhint %}

{% code lineNumbers="true" %}

```scss
// Sass.
@use 'sass:list';
@use 'sass:meta';

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

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

// Functions.
@use 'dictionary.is-global.function';

// The `translator.dictionary-pick()` or `dictionary.pick()` function.
@function pick($key, $dictionary: (), $global: null) {
  $dictionary: if(
    meta.type-of($dictionary) == list and list.length($dictionary) > 0,
    map.retrieve(pick, $dictionary...),
    $dictionary
  );
  @if dictionary.is-global($global) {
    $dictionary: if(
      $key,
      map.deep-merge(
        map.pick(variables.$dictionary, $key...),
        if(meta.type-of($dictionary) == map, map.pick($dictionary, $key...), ())
      ),
      map.deep-merge(variables.$dictionary, $dictionary)
    );
  } @else if $key {
    $dictionary: map.pick($dictionary, $key...);
  }
  @return $dictionary;
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/sass/blob/main/translator/dictionary/_dictionary.pick.function.scss>" %}

### Parameters

#### `$key`

A required key to pick the dictionary from the global dictionary(if in use) and [`$dictionary`](#usddictionary).

#### `$dictionary: ()`

Additional dictionaries along with a [global dictionary](/sass/translator-v0.1.0/dictionary/dictionary.variables.md)(if in use) from which to pick dictionary associated with [`$key`](#usdkey).

{% hint style="info" %}
Dictionary as list indicates picking the dictionary of key, e.g. `$dictionary class` indicates to pick `class` key of `$dictionary`.
{% endhint %}

#### `$global: null`

A `bool` value indicates whether to use a global dictionary. Default, `null`, then [`$dictionary-global`](/sass/translator-v0.1.0/dictionary/dictionary.variables.md) is checked.

### Return

The return value is a dictionary consisting of the global dictionary(if in use) and given [`$dictionary`](#usddictionary) from the associated [`$key`](#usdkey).

## Examples

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

// Examples.
$-dictionary: (
  general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)),
  class: (prefix: spectre-prefix, suffix: spectre-suffix, calendars: (calendar: cal), labels: (label: lab)),
  prefix: spectre,
  suffix: end,
  separator: '--',
  var: (prefix: spectre, suffix: end)
);

// Examples.
// Pick the global dictionary.
@debug translator.pick(null); // (word: translation)

// Deactivate picking from the global dictionary.
@debug translator.pick(null, $global: false); // ()

// Pick dictionary from the `$-dictionary` variable.
@debug translator.pick(null, $-dictionary); // (word: translation, general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)), class: (prefix: spectre-prefix, suffix: spectre-suffix, calendars: (calendar: cal), labels: (label: lab)), prefix: spectre, suffix: end, separator: "--", var: (prefix: spectre, suffix: end))

// Pick dictionary from the `$-dictionary` variable by using string key.
@debug translator.pick(general, $-dictionary); // (general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)))

// Pick dictionary from the `$-dictionary` variable by using deep key.
@debug translator.pick(((class, calendars),), $-dictionary class); // (calendars: (calendar: cal))
@debug translator.pick([(class, calendars)], $-dictionary); // (calendars: (calendar: cal))

// Pick dictionary from the `$-dictionary` with not existing key.
@debug translator.pick(no-field, $-dictionary); // (no-field: null)

// Pick dictionary from the `$-dictionary` variable and `$global` false.
@debug translator.pick(null, $-dictionary, $global: false); // (general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)), class: (prefix: spectre-prefix, suffix: spectre-suffix, calendars: (calendar: cal), labels: (label: lab)), prefix: spectre, suffix: end, separator: "--", var: (prefix: spectre, suffix: end))
@debug translator.pick(general, $-dictionary, $global: false); // (general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)))
@debug translator.pick(no-field, $-dictionary, $global: false); // (no-field: null)

// Pick dictionary by using multiple keys and deep key.
@debug translator.pick((general, var, (class, calendars)), $-dictionary); // (general: (word: słowo, (wrapper, wrap): owijka, technology: (action: akcja)), var: (prefix: spectre, suffix: end), calendars: (calendar: cal))

// Custom dictionary.
@debug translator.pick(class, $-dictionary); // (class: (prefix: spectre-prefix, suffix: spectre-suffix, calendars: (calendar: cal), labels: (label: lab)))
@debug translator.pick((prefix,), $-dictionary); // (prefix: spectre)

// Custom dictionary + pick key
@debug translator.pick(null, $-dictionary ((class, calendars),), $global: false); // (calendars: (calendar: cal))

```
