Merge pull request #2590 from edx/ned/small-tweak-to-early-translation-fix-docs

Small tweak to early-translation fix docs
This commit is contained in:
Ned Batchelder
2014-02-13 14:59:16 -05:00

View File

@@ -521,15 +521,12 @@ defined::
HELLO = _("Hello")
GOODBYE = _("Goodbye")
_ = ugettext
def get_greeting(hello):
if hello:
return _(HELLO)
return ugettext(HELLO)
else:
return _(GOODBYE)
return ugettext(GOODBYE)
Here we define ``_()`` as a pass-through function, so the string will be
found during extraction, but won't be translated too early. Then we redefine
``_()`` to be the real translation lookup function, and use it at runtime to
get the localized string.
Here we define ``_()`` as a pass-through function, so the string will be found
during extraction, but won't be translated too early. Then we use the real
translation function at runtime to get the localized string.