semvec/pypi-packages huggingface dataset:
dj-translate 1.0.4
A simple Django app to automatically translate the pot (`.po`) files generated by django's makemessages command using google translate.
License: MIT License

====================
dj-translate
====================

A simple Django app to automatically translate the pot (`.po`) files generated by django's makemessages command
using google translate.

Installation:
-------------

.. code-block:: bash

    pip install dj-translate

Add ``'autotranslate'`` to your ``INSTALLED_APPS`` setting.

.. code-block:: python

    INSTALLED_APPS = (
        ...
        'autotranslate',
    )

Quickstart:
-----------

.. code-block:: bash

    python manage.py makemessages --no-wrap --no-location --no-obsolete

    python manage.py translate_messages

The command finds all the generated pot (``.po``) files under the locale paths (``LOCALE_PATHS``) specified in django project settings, and translates them automatically.


Options:
--------

#. ``-f, --set-fuzzy``: Set the 'fuzzy' flag on autotranslated entries
#. ``-l, --locale 'locale'``: Only translate the specified locales
#. ``-u, --untranslated``: Only translate the untranslated messages

.. code-block:: bash

    python manage.py translate_messages -l 'de' -l 'es'


Settings:
---------

#. Use a google translation - Web scrapper (Not recomm):

.. code-block:: bash

    AUTOTRANSLATE_TRANSLATOR_SERVICE = 'autotranslate.services.GoSlateTranslatorService'

#. Use a Google API based Translation Service:

.. code-block:: bash

    # default: 'autotranslate.services.GoSlateTranslatorService'
    # pip install google-api-python-client
    AUTOTRANSLATE_TRANSLATOR_SERVICE = 'autotranslate.services.GoogleAPITranslatorService'
    GOOGLE_TRANSLATE_KEY = '<google-api-key>'


Edit translation strings:
--------------------------------

Add an URL entry to your project’s urls.py, for example:

.. code-block:: bash

    from django.conf import settings

    if 'autotranslate' in settings.INSTALLED_APPS:
        urlpatterns += [
            url(r'^autotranslate/', include('autotranslate.urls')),
        ]


Login as admin:

.. code-block:: bash

    Nevigate to : http://127.0.0.1:8000/autotranslate