Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Important things not mentioned in the Django documentation:</p> <ul> <li>run <code>django-admin compilemessages</code>, e.g. as a part of your build process. Thanks stevejalim!</li> <li>apply django's <code>ugettext_lazy()</code> to model names ( <code>Meta</code> class and <code>verbose_name</code> )</li> <li>attribute (model field <code>verbose_name</code>) names can also be translated with <code>ugettext_lazy()</code></li> <li>use lazy translation in your model metadata, otherwise the translation happens while loading the model classes and the settings of your users, especially the browser settings, will not be taken into account</li> <li>I use some scoping for attribute names, e.g. separating the model name and attribute names with a pipe. The same convention is used in ruby-gettext. Background: attribute names like 'title' or 'name' translated differently in the most languages depending on context. Example 'Book|title' -> 'Titel' or 'Buchtitel' in German. But 'Chapter|title' would be translated as 'Überschrift'.</li> </ul> <p>Example using above principles:</p> <pre><code>from django.utils.translation import ugettext_lazy as _ class Order(models.Model): subject = models.CharField(max_length=150, verbose_name = _('Order|subject')) description = models.TextField( verbose_name = _('Order|description')) class Meta: verbose_name = _('order') verbose_name_plural = _('orders') </code></pre> <p>Or is there a better way to translate the model and admin pages?</p> <p>Either way we should enhance the Django documentation and fill the gap!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload