> 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.get.md).

# dictionary.get()

The `dictionary.get()` function returns global dictionary(if in use) along with [`$dictionary`](#usddictionary) and/or from [`$key`](#usdkey-null).

{% 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.
@forward 'dictionary.variables';
@use 'dictionary.variables' as variables;

// Functions.
@use '../../meta/meta.of-type.function' as *;
@use 'dictionary.is-global.function' as *;

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

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

{% endcode %}

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

### Parameters

#### `$key: null`

A key to retrieve dictionary from a global dictionary(if in use) and/or [`$dictionary`](#usddictionary).

#### `$dictionary: ()`

Dictionary of list(dictionary key) or map type to get along with the global dictionary(if in use).&#x20;

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

#### `$default: null`

The default returned value if dictionary is `null`.

#### `$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 [global dictionary](/sass/translator-v0.1.0/dictionary/dictionary.variables.md#usddictionary-default)(if in use) and/or [`$dictionary`](#usddictionary), optionally from [`$key`](#usdkey-null).

## Examples

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

// Examples.
$-dictionary-example: map.merge(translator.$dictionary, (
  (extra large, 'extra large', extra-large): xl,
  (extra small, 'extra small', extra-small): xs,
  border: b,
  class: (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab)),
  color: c,
  general: (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c),
  large: lg,
  medium: md,
  outline: o,
  prefix: spectre,
  small: sm,
  suffix: end,
));

// Get the global dictionary.
@debug translator.dictionary-get(); // (word: translation)

// Deactivate picking from the global dictionary.
@debug translator.dictionary-get($global: false); // ()

// Get the dictionary from the `$dictionary-example` variable.
@debug translator.dictionary-get(null, $-dictionary-example); // (word: translation, (extra large, "extra large", extra-large): xl, (extra small, "extra small", extra-small): xs, border: b, class: (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab)), color: c, general: (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c), large: lg, medium: md, outline: o, prefix: spectre, small: sm, suffix: end)
@debug translator.dictionary-get(null, $-dictionary-example, $global: false); // (word: translation, (extra large, "extra large", extra-large): xl, (extra small, "extra small", extra-small): xs, border: b, class: (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab)), color: c, general: (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c), large: lg, medium: md, outline: o, prefix: spectre, small: sm, suffix: end)

// Get the dictionary from the `$dictionary-example` variable by using string key.
@debug translator.dictionary-get(general, $-dictionary-example); // (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c)
@debug translator.dictionary-get(class, $-dictionary-example); // (prefix: class-prefix, separator: class-separator, suffix: class-suffix, calendars: (calendar: cal), labels: (label: lab))

// Get the dictionary from the `$dictionary-example` variable by using deep key.
@debug translator.dictionary-get((class, calendars), $-dictionary-example); // (calendar: cal)

// Get dictionary from the `$dictionary-example` variable.
@debug translator.dictionary-get(general, $-dictionary-example, $global: false); // (word: słowo, (wrapper, wrap): owijka, (technology, technologia): tech, color: c)

// Get the default value on `null`.
@debug translator.dictionary-get(no-field, $-dictionary-example, (prefix: spectre)); // (prefix: spectre)

// Get dictionary from the `$dictionary-example` variable with a deep key.
@debug translator.dictionary-get(null, $-dictionary-example (class, calendars), $global: false); // (calendar: cal)

// Get single translation.
@debug translator.dictionary-get((class, separator)); // null

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary/dictionary.get.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
