Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riccardofasan/django-polyglot
Django-Polyglot is an integration of Polyglot for Django Web Framework. It provides a CLI command that, using the DeepL API, automates the translation of your static texts.
https://github.com/riccardofasan/django-polyglot
deepl deepl-api django django-application django-commands django-rest-framework i18n polyglot
Last synced: 8 days ago
JSON representation
Django-Polyglot is an integration of Polyglot for Django Web Framework. It provides a CLI command that, using the DeepL API, automates the translation of your static texts.
- Host: GitHub
- URL: https://github.com/riccardofasan/django-polyglot
- Owner: riccardoFasan
- License: mit
- Created: 2021-12-28T09:27:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-12T07:45:49.000Z (over 1 year ago)
- Last Synced: 2024-11-07T11:03:43.489Z (8 days ago)
- Topics: deepl, deepl-api, django, django-application, django-commands, django-rest-framework, i18n, polyglot
- Language: Python
- Homepage: https://pypi.org/project/django-polyglot-translator/
- Size: 67.4 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Django-Polyglot: DeepL integration for Django
Django-Polyglot is an integration of [**Polyglot**](https://github.com/riccardoFasan/polyglot) for [**Django**](https://www.djangoproject.com/) Web Framework.
It provides a CLI command that, using the [**DeepL API**](https://www.deepl.com/it/docs-api/), automates the translation of your static texts.
## Installation
Django Polyglot can be easily installed by running:
```shell
pip install django-polyglot-translator
```Make sure you've configured Django [internationalization](https://docs.djangoproject.com/en/4.0/topics/i18n/).
Now you have to register Django-Polyglot in your settings like this:
```python
INSTALLED_APPS = [
...
'djangoPolyglot'
]
```Finally, you need to store your DeepL API key in your settings.
```python
POLYGLOT_DEEPL_LICENSE = "your DeepL API key"
```## Usage
### Translate
Django-Polyglot will run for you the Django "makemessages" command, preparing the .po files with the text to be translated. Then Polyglot will use the DeepL APIs to translate this files. Finally the Django "compilemessages" command will be ran and your static translations will be ready.
```shell
./manage.py django-polyglot translate
```> ⚠️To use the translate command you need to set **LANGUAGE_CODE**, **LANGUAGES** and **LOCALE_PATHS** in your settings, according the Django documentation.
### Usage info
It returns DeepL usage info related to your API key, run with:
```shell
./manage.py django-polyglot print_usage_info
```### Supported languages
It returns the list of languages currently supported by DeepL, run with:
```shell
./manage.py django-polyglot print_supported_languages
```## Dependencies
The only dependency is [**Polyglot**](https://github.com/riccardoFasan/polyglot).
## License
Django-Polyglot is provided under the MIT license.