mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
This commit is contained in:
parent
4353640ea9
commit
c651331b34
129 changed files with 362 additions and 355 deletions
|
@ -457,10 +457,10 @@ Here are some common problems that you may encounter during initialization:
|
|||
importing an application configuration or a models module triggers code that
|
||||
depends on the app registry.
|
||||
|
||||
For example, :func:`~django.utils.translation.ugettext()` uses the app
|
||||
For example, :func:`~django.utils.translation.gettext()` uses the app
|
||||
registry to look up translation catalogs in applications. To translate at
|
||||
import time, you need :func:`~django.utils.translation.ugettext_lazy()`
|
||||
instead. (Using :func:`~django.utils.translation.ugettext()` would be a bug,
|
||||
import time, you need :func:`~django.utils.translation.gettext_lazy()`
|
||||
instead. (Using :func:`~django.utils.translation.gettext()` would be a bug,
|
||||
because the translation would happen at import time, rather than at each
|
||||
request depending on the active language.)
|
||||
|
||||
|
|
|
@ -860,7 +860,7 @@ subclass::
|
|||
from datetime import date
|
||||
|
||||
from django.contrib import admin
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
class DecadeBornListFilter(admin.SimpleListFilter):
|
||||
# Human-readable title which will be displayed in the
|
||||
|
|
|
@ -186,7 +186,7 @@ registering a custom ``ModelAdmin`` for ``FlatPage``::
|
|||
from django.contrib import admin
|
||||
from django.contrib.flatpages.admin import FlatPageAdmin
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Define a new FlatPageAdmin
|
||||
class FlatPageAdmin(FlatPageAdmin):
|
||||
|
|
|
@ -261,7 +261,7 @@ access to more than a single field::
|
|||
import datetime
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
class Article(models.Model):
|
||||
...
|
||||
|
|
|
@ -1748,11 +1748,11 @@ to restrict language selection to a subset of the Django-provided languages.
|
|||
|
||||
If you define a custom :setting:`LANGUAGES` setting, you can mark the
|
||||
language names as translation strings using the
|
||||
:func:`~django.utils.translation.ugettext_lazy` function.
|
||||
:func:`~django.utils.translation.gettext_lazy` function.
|
||||
|
||||
Here's a sample settings file::
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
LANGUAGES = [
|
||||
('de', _('German')),
|
||||
|
|
|
@ -34,7 +34,7 @@ Helper function to return a URL pattern for serving files in debug mode::
|
|||
]
|
||||
|
||||
The ``regex`` parameter should be a string or
|
||||
:func:`~django.utils.translation.ugettext_lazy()` (see
|
||||
:func:`~django.utils.translation.gettext_lazy()` (see
|
||||
:ref:`translating-urlpatterns`) that contains a regular expression compatible
|
||||
with Python's :py:mod:`re` module. Strings typically use raw string syntax
|
||||
(``r''``) so that they can contain sequences like ``\d`` without the need to
|
||||
|
|
|
@ -16,7 +16,7 @@ different types of fields.
|
|||
For example, here's a validator that only allows even numbers::
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
def validate_even(value):
|
||||
if value % 2 != 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue