Metadata-Version: 2.1
Name: django-translations
Version: 1.0.0.dev3
Summary: A Django app which provides support for model translation.
Home-page: https://github.com/perplexionist/django-translations
Author: Behzad B. Mokhtari
Author-email: 35877268+perplexionist@users.noreply.github.com
License: UNKNOWN
Project-URL: Documentation, https://perplexionist.github.io/django-translations
Project-URL: Funding, https://blockchain.info/address/1FcPBamd6mVrHBNvjB5PqjbnGCBhdY7Rtm
Project-URL: Source, https://github.com/perplexionist/django-translations
Project-URL: Tracker, https://github.com/perplexionist/django-translations/issues
Keywords: django internationalization
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: Django :: 1.11
Classifier: Framework :: Django :: 2.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Internationalization
Requires-Python: >=3.5, <4
Description-Content-Type: text/x-rst

Translations
============

.. image:: https://travis-ci.com/perplexionist/django-translations.svg?branch=master
    :target: https://travis-ci.com/perplexionist/django-translations

Translations app provides an **easy** and **efficient** way of translating
model contents.

Requirements
------------

* Python (>=3.5)
* Django (1.11, >=2.0)

Installation
------------

1. Install Translations using PIP (use ``--pre``, still in development)::

   $ pip install --pre django-translations

2. Add ``'translations'`` to ``INSTALLED_APPS`` in the settings of your Django
   project::

       INSTALLED_APPS = [
           ...
           'translations',
           ...
       ]

3. Run ``migrate``::

   $ python manage.py migrate

Usage
-----

Model
~~~~~

Inherit ``Translatable`` in any model you want translated.

**No migrations** needed afterwards! That's it!

::

    from translations.models import Translatable

    class Question(Translatable):
        ...

    class Choice(Translatable):
        ...

Query
~~~~~

You can use the extended ORM querysets::

    >>> q = Question.objects.create(
    ...     question_text="What's up?",
    ...     category='usuals',
    ... )
    <Question: What's up?>
    >>> q.question_text = 'Quoi de neuf?'
    >>> q.category = 'habituels'
    >>> q.update_translations(lang='fr')
    >>> q.apply_translations(lang='en')
    <Question: What's up?>
    >>> q.apply_translations(lang='fr')
    <Question: Quoi de neuf?>

Admin
~~~~~

You can also use the admin extensions::

    from django.contrib import admin
    from translations.admin import TranslatableAdmin, TranslationInline

    from .models import Question

    class QuestionAdmin(TranslatableAdmin):
        inlines = [TranslationInline,]

    admin.site.register(Question, QuestionAdmin)

Documentation
-------------

For more interesting capabilities browse through the `documentation`_.

.. _documentation: http://perplexionist.github.io/django-translations


