Marijus
Marijus

Reputation: 4375

Django multi-lingual site : how to?

I want to have my website in three languages and allow user to change preffered language somewhere in my template. My models will need translating. I found a few libraries perhaps I should use :

https://code.google.com/p/django-multilingual/ for traslating my models

https://pypi.python.org/pypi/django-localeurl/1.4 for language prefix in URL's

https://docs.djangoproject.com/en/dev/topics/i18n/ for translating static parts of my site

However I can't understand how these come together. Perhaps someone could give me a rundown of steps to translate my website.

Upvotes: 3

Views: 304

Answers (1)

bmihelac
bmihelac

Reputation: 6323

You can use i18n_patterns instead of django-localeurl if you use Django 1.4. or later.

i18n_patterns will set active language based on URL prefix.

Django I18n will serve translated messages in python code and templates based on active language . (You will have to makemessages and compilemessages to create and compile translations).

For translations in model there are lot of libraries, majority of them use active language to serve field translation. I prefer django-modeltranslation, which allows translating of 3rd party app models without changing their code.

Hope this helps!

Upvotes: 5

Related Questions