# Multilanguage & Translation

## <mark style="color:red;">Adding Required Settings​</mark> <a href="#adding-required-settings" id="adding-required-settings"></a>

The infrastructure required to add multilanguage support has already been implemented in Project Zero. Languages ​​to be used and default language should be added to the settings.

**omnife\_base/settings.py**

```
LANGUAGE_CODE = 'tr'
 
LANGUAGES = [
   ('tr', 'Türkçe'),
   ('en-us', 'English')
]
```

## <mark style="color:red;">Creating Language Files​</mark> <a href="#creating-language-files" id="creating-language-files"></a>

In order to create the relevant language files, a "locale" directory must be created in the root directory of the project. In addition, the corresponding directory for each of the language codes in settings.py must be created under "locale". (Example: locale/en, locale/fr etc.)

After the directories are created, the following commands should be executed to create editable language files (.po).

For translations in Django templates:

```
python manage.py makemessages --ignore venv
```

For translations in Javascript:

```
python manage.py makemessages -d djangojs --ignore node_modules
```

After executing these commands, .po files will be created under the relevant directory for each language. (Example: locale/en/LC\_MESSAGES/django.po, locale/en/LC\_MESSAGES/djangojs.po).

After the necessary translations are made in these files, the .po files must be compiled with the following command.

```
python manage.py compilemessages -l en
```

## <mark style="color:red;">Changing Language​</mark> <a href="#changing-language" id="changing-language"></a>

To change the language, the language code must be passed to the setlang url with the language parameter. Example:

`POST`

```
example.com/setlang

language: en-us
```


---

# 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://docs.akinon.com/technical-guides/project-zero/django/project-structure/multilanguage-and-translation.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.
