# Multilingual

## 1. Theme "Text Domain" requirement

Advanced Views utilizes WordPress's built-in multilingual capabilities, and in order to translate strings within *Layouts* and *Post Selections*, your theme must define the "Text Domain" in the [theme's style.css file](https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/).

{% hint style="info" %}
If you are using a pre-built theme, no action is required on your part. However, if you are using a custom theme or a custom child theme, open the **style.css** file in the root folder and ensure that the "Text Domain" is defined in the header. If it is missing, add it in the format "Text Domain: x," where x can be your own name (with dashes as delimiters) or the same value as your parent theme.
{% endhint %}

## 2. Single *Layout* and *Post Selection* for different languages

Advanced Views uses the built-in WordPress translation function `__('field label', 'yourThemeTextDomain')` for all *Layouts* and *Post Selection* labels. This allows you to translate labels seamlessly using your preferred multilingual plugin, eliminating the need for creating a separate Layout or *Post Selection* for every language.

{% hint style="info" %}
'`yourThemeTextDomain`' will be picked up automatically, based on the Text Domain defined in the heading of the **style.css** file of your current theme.
{% endhint %}

## 3. Automatic strings detection (in your translation tool)

While the multilingual string translation works out-of-the-box, by default, there is no 'labels list' in your theme, and your translation tool will require 'registering/entering' each string manually.

To streamline this process, you can active the [File system storage](https://docs.advanced-views.com/templates/file-system-storage). When enabled, during *Layout* and *Post Selection* saving process, Advanced Views automatically deposits the labels into special files. It enables the use of the 'scan' feature in your translation tool, automatically loading all labels for efficient translation.

## 4. Translate labels within templates&#x20;

Multilingual capabilities extend to the Twig and Blade templates as well.

### 4.1) Blade

Blade allows you to call any PHP functions, so you can translate any string by calling the [WordPress translate (\_\_) function](https://developer.wordpress.org/reference/functions/__/), as you would do normally:

```
{{ __("my-string", "yourThemeTextDomain") }}
```

### 4.2) Twig (Pro)

&#x20;To translate labels within your Twig template, employ our [translation function](/advanced-views/templates/template-engines/twig.md#our-functions) or filter.

Upon saving a *Layout* or *Post Selection*, Advanced Views will scan all these translation calls and interact with them in the same manner, like with the labels from the UI, described above.


---

# Agent Instructions: 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://wplake.gitbook.io/advanced-views/templates/multilingual.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.
