I am working on a Django project which is localized and works fine in many languages. Now for a reason I need to call ugettext
from its shell.
Here is what I did:
>>> from django.conf import settings
>>> settings.LANGUAGE_CODE
u'fa-ir'
>>> from django.utils.translation import ugettext as _
>>> print _("Schedule & Details")
Schedule & Details
As you see the phrase "Schedule & Details" did not print in Persian language.
Is it possible to translate a phrase and then print it inside Django shell?
u"Schedule & Details"
? Python 2 strings aren't Unicode by default (though these characters all appear to be ASCII, which should amount to the same thing).