I am using multiple translation in my project
For that I have updated my settings file as
LANGUAGE_CODE = 'en-us'
gettext = lambda s: s
LANGUAGES = (
('es', gettext('Spanish')),
('en', gettext('English')),
)
LOCALE_PATHS = (
'/mnt/aviesta/pythondev/django/locale',
)
USE_I18N = True
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.request",
)
And my template file as:
{% load i18n %}
{% trans "Hello" %}
<p>Already a user <a href="/login/"><b>{% trans "login here" %}</b></a></p>
after that I create a locale folder parallel to my app and than create the specific language folders in it as :django-admin.py makemessages -l es which creates the .po file and then update this .po file as:
#: customer_reg/customer_register.html:14
msgid "Hello"
msgstr "¡Hola"
#: customer_reg/customer_register.html:17
msgid "login here"
msgstr "ingresa aquí"
And finally i compiled my msg django-admin.py compilemessages
BUt my strings "hello" and "login here" is remain in English, they are not translated.I don't know why it happens ??