mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-18 17:41:09 +00:00
Consistent capitalization of titles in docs.
This commit is contained in:
parent
6acd07276e
commit
cda6ae19c8
9 changed files with 48 additions and 28 deletions
|
|
@ -23,7 +23,7 @@ Features
|
|||
- Supports inherited models
|
||||
|
||||
|
||||
Project home
|
||||
Project Home
|
||||
------------
|
||||
https://github.com/deschler/django-modeltranslation
|
||||
|
||||
|
|
@ -31,6 +31,6 @@ Documentation
|
|||
-------------
|
||||
https://readthedocs.org/projects/django-modeltranslation
|
||||
|
||||
Mailing list
|
||||
Mailing List
|
||||
------------
|
||||
http://groups.google.com/group/django-modeltranslation
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.. _admin:
|
||||
|
||||
Django admin integration
|
||||
Django Admin Integration
|
||||
========================
|
||||
|
||||
In order to be able to edit the translations via the ``django.contrib.admin``
|
||||
|
|
@ -21,7 +21,7 @@ the most simple case would look like:
|
|||
admin.site.register(News, NewsAdmin)
|
||||
|
||||
|
||||
Tweaks applied to the admin
|
||||
Tweaks Applied to the Admin
|
||||
---------------------------
|
||||
|
||||
formfield_for_dbfield
|
||||
|
|
@ -71,7 +71,7 @@ the translation fields of ``title``, but not the original field:
|
|||
|
||||
.. _translationadmin_in_combination_with_other_admin_classes:
|
||||
|
||||
TranslationAdmin in combination with other admin classes
|
||||
TranslationAdmin in Combination with Other Admin Classes
|
||||
--------------------------------------------------------
|
||||
|
||||
If there already exists a custom admin class for a translated model and you
|
||||
|
|
@ -99,7 +99,7 @@ through the blog app, it has to be unregistered first:
|
|||
admin.site.register(Entry, MyTranslatedEntryAdmin)
|
||||
|
||||
|
||||
Admin classes that override ``formfield_for_dbfield``
|
||||
Admin Classes that Override ``formfield_for_dbfield``
|
||||
*****************************************************
|
||||
|
||||
In a more complex setup the original ``EntryAdmin`` might override
|
||||
|
|
@ -205,7 +205,7 @@ __ translationadmin_in_combination_with_other_admin_classes_
|
|||
admin.site.register(News, NewsAdmin)
|
||||
|
||||
|
||||
Using tabbed translation fields
|
||||
Using Tabbed Translation Fields
|
||||
-------------------------------
|
||||
|
||||
.. versionadded:: 0.3
|
||||
|
|
@ -228,8 +228,10 @@ The proposed way to include it is through the inner ``Media`` class of a
|
|||
}
|
||||
|
||||
The ``force_jquery.js`` script is necessary when using Django's built-in
|
||||
``django.jQuery`` object. This and the static urls used are just an example and
|
||||
might have to be adopted to your setup of serving static files.
|
||||
``django.jQuery`` object.
|
||||
|
||||
.. note:: This is just an example and might have to be adopted to your setup of
|
||||
serving static files.
|
||||
|
||||
Standard jquery-ui theming can be used to customize the look of tabs, the
|
||||
provided css file is supposed to work well with a default Django admin.
|
||||
|
|
|
|||
|
|
@ -29,9 +29,10 @@ field is updated:
|
|||
>>>
|
||||
|
||||
|
||||
Accessing translated fields outside views
|
||||
Accessing Translated Fields Outside Views
|
||||
-----------------------------------------
|
||||
Since the ``modeltranslation`` mechanism relies on the current language as it
|
||||
|
||||
Since the modeltranslation mechanism relies on the current language as it
|
||||
is returned by the ``get_language`` function care must be taken when accessing
|
||||
translated fields outside a view function.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
.. _commands:
|
||||
|
||||
Management commands
|
||||
Management Commands
|
||||
===================
|
||||
|
||||
.. _commands-update_translation_fields:
|
||||
|
||||
The ``update_translation_fields`` command
|
||||
The ``update_translation_fields`` Command
|
||||
-----------------------------------------
|
||||
|
||||
In case the modeltranslation app was installed on an existing project and you
|
||||
have specified to translate fields of models which are already synced to the
|
||||
database, you have to update your database schema manually.
|
||||
|
|
@ -33,8 +34,9 @@ All translated models (as specified in the project's ``translation.py`` will be
|
|||
populated with initial data.
|
||||
|
||||
|
||||
The ``sync_translation_fields`` command
|
||||
The ``sync_translation_fields`` Command
|
||||
---------------------------------------
|
||||
|
||||
.. versionadded:: 0.4
|
||||
|
||||
.. code-block:: console
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
.. include:: readme.rst
|
||||
|
||||
|
||||
Table of content
|
||||
================
|
||||
Table of Contents
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
Using pip
|
||||
Using Pip
|
||||
---------
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install django-modeltranslation
|
||||
|
||||
Using the source
|
||||
|
||||
Using the Source
|
||||
----------------
|
||||
|
||||
Get a source tarball from `github`_ or `pypi`_, unpack, then install with:
|
||||
|
|
@ -47,17 +48,19 @@ in detail in the following sections:
|
|||
in that case.
|
||||
|
||||
|
||||
Configure the project's ``settings.py``
|
||||
Configure the Project's ``settings.py``
|
||||
---------------------------------------
|
||||
|
||||
Required settings
|
||||
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:
|
||||
|
||||
|
|
@ -72,10 +75,12 @@ Make sure that the ``modeltranslation`` app is listed in your
|
|||
.. note:: Also make sure that the app can be found on a path contained in your
|
||||
``PYTHONPATH`` environment variable.
|
||||
|
||||
|
||||
.. _settings-languages:
|
||||
|
||||
``LANGUAGES``
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
The ``LANGUAGES`` variable must contain all languages used for translation. The
|
||||
first language is treated as the *default language*.
|
||||
|
||||
|
|
@ -97,12 +102,15 @@ modeltranslation app, but rather required for Django to be able to
|
|||
(statically) translate the verbose names of the languages using the standard
|
||||
``i18n`` solution.
|
||||
|
||||
Advanced settings
|
||||
|
||||
Advanced Settings
|
||||
*****************
|
||||
|
||||
Modeltranslation also has some advanced settings to customize its behaviour:
|
||||
|
||||
``MODELTRANSLATION_DEFAULT_LANGUAGE``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 0.3
|
||||
|
||||
Default: ``None``
|
||||
|
|
@ -121,6 +129,7 @@ Example:
|
|||
|
||||
``MODELTRANSLATION_TRANSLATION_FILES``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 0.4
|
||||
|
||||
Default: ``()`` (empty tuple)
|
||||
|
|
@ -157,8 +166,12 @@ Example:
|
|||
automatically added to ``MODELTRANSLATION_TRANSLATION_FILES``. A
|
||||
``DeprecationWarning`` is issued in this case.
|
||||
|
||||
|
||||
``MODELTRANSLATION_CUSTOM_FIELDS``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Default: ``()`` (empty tuple)
|
||||
|
||||
.. versionadded:: 0.3
|
||||
|
||||
``Modeltranslation`` officially supports ``CharField`` and ``TextField``.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.. _registration:
|
||||
|
||||
Registering models and their fields for translation
|
||||
===================================================
|
||||
Registering Models for Translation
|
||||
==================================
|
||||
|
||||
The ``modeltranslation`` app can translate ``CharField`` and ``TextField``
|
||||
based fields (as well as ``FileField`` and ``ImageField`` as of version 0.4)
|
||||
|
|
@ -60,7 +60,7 @@ translation will have been added some auto-magical fields. The next section
|
|||
explains how things are working under the hood.
|
||||
|
||||
|
||||
Changes automatically applied to the model class
|
||||
Changes Automatically Applied to the Model Class
|
||||
------------------------------------------------
|
||||
|
||||
After registering the ``News`` model for translation an SQL dump of the
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.. _related_projects:
|
||||
|
||||
Related projects
|
||||
Related Projects
|
||||
================
|
||||
|
||||
.. note:: This list is horribly outdated and only covers apps that where
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.. _usage:
|
||||
|
||||
Accessing translated and translation fields
|
||||
Accessing Translated and Translation Fields
|
||||
===========================================
|
||||
|
||||
The modeltranslation app changes the behaviour of the translated fields. To
|
||||
|
|
@ -32,8 +32,9 @@ fields*. If the default language is ``en``, the ``title_en`` and ``text_en``
|
|||
fields would be the *default translation fields*.
|
||||
|
||||
|
||||
Rules for translated field access
|
||||
Rules for Translated Field Access
|
||||
---------------------------------
|
||||
|
||||
So now when it comes to setting and getting the value of the original and the
|
||||
translation fields the following rules apply:
|
||||
|
||||
|
|
@ -59,8 +60,9 @@ translation fields the following rules apply:
|
|||
updated at the same time, the default translation field wins.
|
||||
|
||||
|
||||
Examples for translated field access
|
||||
Examples for Translated Field Access
|
||||
------------------------------------
|
||||
|
||||
Because the whole point of using the modeltranslation app is translating
|
||||
dynamic content, the fields marked for translation are somehow special when it
|
||||
comes to accessing them. The value returned by a translated field is depending
|
||||
|
|
|
|||
Loading…
Reference in a new issue