# Translations

ShipWithDjango simplifies the process of managing translations through the use of Django Rosetta, a powerful tool that provides a fully functional graphical interface for handling your application's translations. This means you can easily manage your translations without needing to directly edit `.mo` and `.po` files. For more details about Django Rosetta, you can visit the [Django Rosetta documentation](https://django-rosetta.readthedocs.io/).

### Configuration Details

#### Source Language

The `SOURCE_LANGUAGE_CODE` and `SOURCE_LANGUAGE_NAME` settings define the primary language of your application, which serves as the source language for all translations.

```python
SOURCE_LANGUAGE_CODE = 'en-us'
SOURCE_LANGUAGE_NAME = 'English'
```

#### Rosetta Messages Per Page

The `ROSETTA_MESSAGES_PER_PAGE` setting controls how many translation messages are displayed per page in the Rosetta interface. Adjusting this number can help you manage the volume of translations you work with at one time.

```python
ROSETTA_MESSAGES_PER_PAGE = 100
```

#### Translating Languages

* **`ROSETTA_LANGUAGES`**: This setting lists the languages that can be translated from the source language using the admin panel. Note that these languages are only available in the admin panel for translation purposes and are not visible to users on the front end. If you want these languages to be selectable by users, you need to add them to the `LANGUAGES` setting.

  ```python
  ROSETTA_LANGUAGES = []
  ```
* **`LANGUAGES`**: This setting defines the languages available for users to select on the front end of your application. Languages listed here will also be available for translation in the admin panel.

  ```python
  LANGUAGES = [
      ('en-us', 'English')
  ]
  ```

#### Translation Service API Keys

If you use external translation services, ShipWithDjango supports integration with various providers through API keys. These services can assist in automating or improving the accuracy of your translations.

* **Yandex Translate**: Set the `YANDEX_TRANSLATE_KEY` to use Yandex's translation services.
* **Azure Translator**: Set the `AZURE_CLIENT_SECRET` to integrate with Microsoft's Azure Translator service.
* **DeepL**: Set the `DEEPL_AUTH_KEY` to use the DeepL translation service.

```python
YANDEX_TRANSLATE_KEY = None  # See http://api.yandex.com/translate/
AZURE_CLIENT_SECRET = None  # See https://learn.microsoft.com/en-us/azure/ai-services/translator/
DEEPL_AUTH_KEY = None  # See https://www.deepl.com/pro#developerr
```

### Adding More Languages

To add more languages for translation:

1. **For Admin Translation Only**: Add the language codes to `ROSETTA_LANGUAGES`. These languages will be available in the Rosetta interface but not on the front end.

   ```python
   ROSETTA_LANGUAGES = [
       ('es', 'Spanish'),
       ('fr', 'French'),
   ]
   ```
2. **For User Selection**: Add the language codes to `LANGUAGES`. This will make them available both in the Rosetta interface and on the front end for users to select.

   ```python
   LANGUAGES = [
       ('en-us', 'English'),
       ('es', 'Spanish'),
       ('fr', 'French'),
   ]
   ```

###
