I have the following setup -
folders structure:
myapp
- conf
- locale
- ru
- LC_MESSAGES
- django.mo # contains "This is the title." translation
- django.po
- templates
- index.html
setting.py
main.py
app.yaml:
...
env_variables:
DJANGO_SETTINGS_MODULE: 'settings'
handlers:
...
- url: /locale/ # do I need this?
static_dir: templates/locale
libraries:
- name: django
version: "1.5"
settings.py:
USE_I18N = True
LANGUAGES = (
('en', 'EN'),
('ru', 'RU'),
)
LANGUAGE_CODE = 'ru'
LANGUAGE_COOKIE_NAME = 'django_language'
SECRET_KEY = 'some-dummy-value'
MIDDLEWARE_CLASSES = (
'django.middleware.locale.LocaleMiddleware'
)
LOCALE_PATHS = (
'/locale',
'/templates/locale',
)
index.html:
{% load i18n %}
...
{% trans "This is the title." %}
and main.py:
from google.appengine.ext.webapp import template
...
translation.activate('ru')
template_values = {}
file_template = template.render('templates/index.html', template_values)
self.response.out.write(file_template)
But in result "This is the title."
is displayed in English. What is wrong with my setup (or files location)?
template_values = {}
doesn't that mean you are using empty dictionary to format/render the html page? what is it's value after the.render
? what if you change template_values to something like:template_values = {"trans":"ru"}
? – Whitford{"trans":"ru"}
- it didn't help. – Foehn