1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

unicode: Made some small tweaks to the i18n docs. The whole file could do with

a rewrite, though, I suspect.


git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-05-24 02:20:34 +00:00
parent 3989feed0c
commit fbce6f6bdc

View File

@ -70,8 +70,7 @@ Standard translation
Specify a translation string by using the function ``ugettext()``. Since you Specify a translation string by using the function ``ugettext()``. Since you
may well be typing this a lot, it's often worthwhile importing it as a shorter may well be typing this a lot, it's often worthwhile importing it as a shorter
alias and ``_`` is a very common choice (i.e. the function is called as alias and ``_`` is a very common choice.
``_()``).
.. note:: .. note::
Python's standard library ``gettext`` module installs ``_()`` into the Python's standard library ``gettext`` module installs ``_()`` into the
@ -80,9 +79,10 @@ alias and ``_`` is a very common choice (i.e. the function is called as
1. For international character set (unicode) support, you really wanting 1. For international character set (unicode) support, you really wanting
to be using ``ugettext()``, rather than ``gettext()``. Sometimes, you to be using ``ugettext()``, rather than ``gettext()``. Sometimes, you
should be using ``ugettext_lazy()`` more often. By not installing should be using ``ugettext_lazy()`` as the default translation method
``_`` directly, the developer is required to think about which is the for a particular file. By not installing ``_`` directly, the
most appropriate function to use. developer has to think about which is the most appropriate function
to use.
2. Python's interactive shell uses ``_`` to represent "the previous 2. Python's interactive shell uses ``_`` to represent "the previous
result". This is also used in doctest tests and having ``_()`` causes result". This is also used in doctest tests and having ``_()`` causes
@ -182,7 +182,7 @@ If you don't like the verbose name ``ugettext_lazy``, you can just alias it as
class MyThing(models.Model): class MyThing(models.Model):
name = models.CharField(help_text=_('This is the help text')) name = models.CharField(help_text=_('This is the help text'))
Always use lazy translations in `Django models`_. And it's a good idea to add Always use lazy translations in `Django models`_. It's a good idea to add
translations for the field names and table names, too. This means writing translations for the field names and table names, too. This means writing
explicit ``verbose_name`` and ``verbose_name_plural`` options in the ``Meta`` explicit ``verbose_name`` and ``verbose_name_plural`` options in the ``Meta``
class, though:: class, though::