> 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/translator.translate.md).

# 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`](/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: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`](/sass/translator-v0.1.0/dictionary/dictionary.variables.md) is checked.

### Return

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

## Examples

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

// Examples.


```


---

# 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:

```
GET https://docs.angular-package.dev/sass/translator-v0.1.0/translator.translate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
