# translator.translate()

The `translator.translate()` function translates `string`, `map`, or `list` with a global dictionary and/or [`$dictionary`](#usddictionary), optionally with a dictionary retrieved by [`$key`](#usdkey-null).

{% hint style="info" %}
Global dictionary is in use on [`$dictionary-global`](https://docs.angular-package.dev/sass/dictionary/dictionary.variables#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:map';
@use 'sass:meta';

// Functions.
@use 'translator.dictionary.function';

// Modules.
@use 'dictionary';
@use 'translate';

// The `translator.translate()` function.
@function translate($words, $key: null, $dictionary: (), $global: null) {
  @return meta.call(
    map.get(
      (
        list: meta.get-function(list, false, translate),
        map: meta.get-function(map, false, translate),
        string: meta.get-function(string, false, translate),
      ),
      meta.type-of($words)
    ),
    $words,
    null,
    translator.dictionary($key, $dictionary, $global)
  );
}
```

{% endcode %}

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

### Parameters

#### `$words`

The words in `string`, `list`, or `map` to translate.

#### `$key: null`

A key of the dictionary that is used to translate [`$words`](#usdwords).

#### `$dictionary: ()`

The dictionary of map or list type(dictionary key) used to translate [`$words`](#usdwords).

#### `$global: null`

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

### Return

The return value is a flattened map dictionary consisting of (word:translation).

## Examples

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

// Examples.


```
