bogen
bogen

Reputation: 10432

How can i internationalize Django HTML Templates using App Engine with python?

I am writing a web site http://www.perlesloyfer.no that will use

country = self.request.headers.get('X-AppEngine-Country') to determine if its a norwegian visitor or one from another language. The template is shown using

path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, template_values))

If visitor is from another country, it should show the HTML templates internationalized to english, else they should be on norwegian like it is now.

Should i make separate html templates for each language, or is it a way to make one template and just get strings from different files with Django?

Upvotes: 0

Views: 85

Answers (1)

Takashi Matsuo
Takashi Matsuo

Reputation: 3436

Django has a decent i18n feature. Please just use it. As a side note, using X-AppEngine-Country to determine the content language is a bad idea (don't forget people abroad).

Upvotes: 2

Related Questions