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