<commit_before>.. _installation:

Installation
============

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

+------------------+------------+-----------+
| Modeltranslation | Python     | Django    |
+==================+============+===========+
| >=0.7            | 3.2 - 3.3  | 1.5 - 1.6 |
|                  +------------+-----------+
|                  | 2.6 - 2.7  | 1.4 - 1.6 |
+------------------+------------+-----------+
| ==0.5, ==0.6     | 2.6 - 2.7  |       1.5 |
|                  +------------+-----------+
|                  | 2.5 - 2.7  | 1.3 - 1.4 |
+------------------+------------+-----------+
| ==0.4            | 2.5 - 2.7  | 1.3 - 1.4 |
+------------------+------------+-----------+
| <=0.3            | 2.4 - 2.7  | 1.0 - 1.4 |
+------------------+------------+-----------+


Using Pip
---------

.. code-block:: console

    $ pip install django-modeltranslation


Using the Source
----------------

Get a source tarball from `pypi`_, unpack, then install with:

.. code-block:: console

    $ python setup.py install

.. note:: As an alternative, if you don't want to mess with any packaging tool,
          unpack the tarball and copy/move the modeltranslation directory
          to a path listed in your ``PYTHONPATH`` environment variable.

.. _pypi: http://pypi.python.org/pypi/django-modeltranslation/


Setup
=====

To setup the application please follow these steps. Each step is described
in detail in the following sections:

1. Add the ``modeltranslation`` app to the ``INSTALLED_APPS`` variable of your
   project's ``settings.py``.

#. Set ``USE_I18N = True`` in ``settings.py``.

#. Configure your ``LANGUAGES`` in ``settings.py``.

#. Create a ``translation.py`` in your app directory and register
   ``TranslationOptions`` for every model you want to translate.

#. Sync the database using ``./manage.py syncdb`` (note that this only applies
   if the models registered in the ``translation.py`` did not have been
   synced to the database before. If they did - read :ref:`further down <db-fields>` what to do
   in that case.


Configuration
=============

Required Settings
-----------------

The following variables have to be added to or edited in the project's
``settings.py``:


``INSTALLED_APPS``
^^^^^^^^^^^^^^^^^^

Make sure that the ``modeltranslation`` app is listed in your
``INSTALLED_APPS`` variable::

    INSTALLED_APPS = (
        ...
        'modeltranslation',
        ....
    )


.. _settings-languages:

``LANGUAGES``
^^^^^^^^^^^^^

The ``LANGUAGES`` variable must contain all languages used for translation. The
first language is treated as the *default language*.

The modeltranslation application uses the list of languages to add localized
fields to the models registered for translation. To use the languages ``de``<commit_msg>Added note about INSTALLED_APPS order when admin is used.<commit_after>.. _installation:

Installation
============

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

+------------------+------------+-----------+
| Modeltranslation | Python     | Django    |
+==================+============+===========+
| >=0.7            | 3.2 - 3.3  | 1.5 - 1.6 |
|                  +------------+-----------+
|                  | 2.6 - 2.7  | 1.4 - 1.6 |
+------------------+------------+-----------+
| ==0.5, ==0.6     | 2.6 - 2.7  |       1.5 |
|                  +------------+-----------+
|                  | 2.5 - 2.7  | 1.3 - 1.4 |
+------------------+------------+-----------+
| ==0.4            | 2.5 - 2.7  | 1.3 - 1.4 |
+------------------+------------+-----------+
| <=0.3            | 2.4 - 2.7  | 1.0 - 1.4 |
+------------------+------------+-----------+


Using Pip
---------

.. code-block:: console

    $ pip install django-modeltranslation


Using the Source
----------------

Get a source tarball from `pypi`_, unpack, then install with:

.. code-block:: console

    $ python setup.py install

.. note:: As an alternative, if you don't want to mess with any packaging tool,
          unpack the tarball and copy/move the modeltranslation directory
          to a path listed in your ``PYTHONPATH`` environment variable.

.. _pypi: http://pypi.python.org/pypi/django-modeltranslation/


Setup
=====

To setup the application please follow these steps. Each step is described
in detail in the following sections:

1. Add the ``modeltranslation`` app to the ``INSTALLED_APPS`` variable of your
   project's ``settings.py``.

#. Set ``USE_I18N = True`` in ``settings.py``.

#. Configure your ``LANGUAGES`` in ``settings.py``.

#. Create a ``translation.py`` in your app directory and register
   ``TranslationOptions`` for every model you want to translate.

#. Sync the database using ``./manage.py syncdb`` (note that this only applies
   if the models registered in the ``translation.py`` did not have been
   synced to the database before. If they did - read :ref:`further down <db-fields>` what to do
   in that case.


Configuration
=============

Required Settings
-----------------

The following variables have to be added to or edited in the project's
``settings.py``:


``INSTALLED_APPS``
^^^^^^^^^^^^^^^^^^

Make sure that the ``modeltranslation`` app is listed in your
``INSTALLED_APPS`` variable::

    INSTALLED_APPS = (
        ...
        'modeltranslation',
        ....
    )

.. important::
    If you want to use the admin integration, ``modeltranslation`` must be put
    before ``django.contrib.admin``.

.. _settings-languages:

``LANGUAGES``
^^^^^^^^^^^^^

The ``LANGUAGES`` variable must contain all languages used for translation. The
first language is treated as the *default language*.

The modeltranslation application uses the list of languages to add localized
fields to the models registered for translation. To use the languages ``de``
{'fraction_non_alphanumeric': 0.24812292648856293, 'fraction_numerical': 0.020604155753448577, 'mean_word_length': 1.8625687156421789, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6186522', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1532, 'n_words': 558}