From b1e82903acdb47905e7e993e23de7d290dc81d5a Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 28 Oct 2014 12:14:30 +0100 Subject: [PATCH] =?UTF-8?q?Apparently=20you=20no=20longer=20need=20a=20?= =?UTF-8?q?=E2=80=9Afake=E2=80=98=20lazy=20lambda=20and=20can=20use=20uget?= =?UTF-8?q?text=20right=20away=20in=20the=20settings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I remember this was not possible since gettext requires settings itself and so you had a cross reference. Maybe I was just wrong too. --- docs/settings.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 9adc951..7b0e082 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -53,12 +53,12 @@ behavior without touching the code: Choices. A tuple of seconds and a descriptive string used in the lexer expiration dropdown. Example:: - ugettext = lambda s: s + from django.utils.translation import ugettext_lazy as _ DPASTE_EXPIRE_CHOICES = ( - (3600, ugettext(u'In one hour')), - (3600 * 24 * 7, ugettext(u'In one week')), - (3600 * 24 * 30, ugettext(u'In one month')), - (3600 * 24 * 30 * 12 * 100, ugettext(u'100 Years')), + (3600, _(u'In one hour')), + (3600 * 24 * 7, _(u'In one week')), + (3600 * 24 * 30, _(u'In one month')), + (3600 * 24 * 30 * 12 * 100, _(u'100 Years')), ) **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 expire choices:: - ugettext = lambda s: s + from django.utils.translation import ugettext_lazy as _ DPASTE_EXPIRE_CHOICES = ( - ('onetime', ugettext(u'One-Time snippet')), - (3600, ugettext(u'In one hour')), - (3600 * 24 * 7, ugettext(u'In one week')), - (3600 * 24 * 30, ugettext(u'In one month')), + ('onetime', _(u'One-Time snippet')), + (3600, _(u'In one hour')), + (3600 * 24 * 7, _(u'In one week')), + (3600 * 24 * 30, _(u'In one month')), ) 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 these snippets:: - ugettext = lambda s: s + from django.utils.translation import ugettext_lazy as _ DPASTE_EXPIRE_CHOICES = ( - (3600, ugettext(u'In one hour')), - (u'never', ugettext(u'Never')), + (3600, _(u'In one hour')), + (u'never', _(u'Never')), ) ``DPASTE_EXPIRE_DEFAULT``