Apparently you no longer need a ‚fake‘ lazy lambda and can use ugettext right away in the settings.

I remember this was not possible since gettext requires settings itself and so you had a cross reference. Maybe I was just wrong too.
This commit is contained in:
Martin Mahner 2014-10-28 12:14:30 +01:00
parent 7821056b64
commit b1e82903ac

View file

@ -53,12 +53,12 @@ behavior without touching the code:
Choices. A tuple of seconds and a descriptive string used in the lexer Choices. A tuple of seconds and a descriptive string used in the lexer
expiration dropdown. Example:: expiration dropdown. Example::
ugettext = lambda s: s from django.utils.translation import ugettext_lazy as _
DPASTE_EXPIRE_CHOICES = ( DPASTE_EXPIRE_CHOICES = (
(3600, ugettext(u'In one hour')), (3600, _(u'In one hour')),
(3600 * 24 * 7, ugettext(u'In one week')), (3600 * 24 * 7, _(u'In one week')),
(3600 * 24 * 30, ugettext(u'In one month')), (3600 * 24 * 30, _(u'In one month')),
(3600 * 24 * 30 * 12 * 100, ugettext(u'100 Years')), (3600 * 24 * 30 * 12 * 100, _(u'100 Years')),
) )
**One-Time snippets** are supported. One-Time snippets are automatically **One-Time snippets** are supported. One-Time snippets are automatically
@ -66,12 +66,12 @@ behavior without touching the code:
enable one-time snippets you have to add a choice ``onetime`` to the enable one-time snippets you have to add a choice ``onetime`` to the
expire choices:: expire choices::
ugettext = lambda s: s from django.utils.translation import ugettext_lazy as _
DPASTE_EXPIRE_CHOICES = ( DPASTE_EXPIRE_CHOICES = (
('onetime', ugettext(u'One-Time snippet')), ('onetime', _(u'One-Time snippet')),
(3600, ugettext(u'In one hour')), (3600, _(u'In one hour')),
(3600 * 24 * 7, ugettext(u'In one week')), (3600 * 24 * 7, _(u'In one week')),
(3600 * 24 * 30, ugettext(u'In one month')), (3600 * 24 * 30, _(u'In one month')),
) )
You can also set the maximum view count after what the snippet gets You can also set the maximum view count after what the snippet gets
@ -84,10 +84,10 @@ behavior without touching the code:
you set the choice key to ``never``. The management command will ignore you set the choice key to ``never``. The management command will ignore
these snippets:: these snippets::
ugettext = lambda s: s from django.utils.translation import ugettext_lazy as _
DPASTE_EXPIRE_CHOICES = ( DPASTE_EXPIRE_CHOICES = (
(3600, ugettext(u'In one hour')), (3600, _(u'In one hour')),
(u'never', ugettext(u'Never')), (u'never', _(u'Never')),
) )
``DPASTE_EXPIRE_DEFAULT`` ``DPASTE_EXPIRE_DEFAULT``