Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: Running site on many languages

I want to run an article site on several languages, I already translated translation strings, so my templates are ready. I only have a questions how to store articles in many languages? Should I create a database for each translation or it works in different way?

If I have for example this basic model:

class Article(models.Model):
    models.TextField()

And want to store data in many languages, how do I do it? How to organize redirects between one article on different languages

like image 563
Oleg Tarasenko Avatar asked Dec 31 '09 07:12

Oleg Tarasenko


People also ask

Can a website have multiple languages?

A multi-lingual website is a website where the content is written in more than one language. The information displayed in different languages is often the same, but maybe tailored for different audiences. Booking.com is an example of a multi-lingual website as its content is available in 35 different languages.

Is Django multilingual?

Django Simple Multilingual Support for models An inefficient, minimal and utterly simple approach to model translation based on foreign key relations and attribute proxying. The project code is forked from the original project by yazzgoth on Google code.

How do I translate a website into multiple languages?

Weglot is a complete multilingual solution that lets you automatically translate your entire website into over 100 languages. It uses a combination of Google, Microsoft, and DeepL translation services depending on the language pair – to deliver the most accurate results.


2 Answers

One simple approach to this problem is to add a "language" field in each model which identifies the language used for each record. This seems to be the approach used by django-pluggable-model-i18n.

Another approach is to use Python metaclasses to identify fields for translation, as used by django-translate and django-transmeta.

There are several other projects but many of them seem abandoned or lower quality. Django-transmeta always seemed the most interesting to me.

Edit: muhuk just wrote an excellent article today reviewing different translation projects: http://www.muhuk.com/2010/01/dynamic-translation-apps-for-django/

like image 150
Van Gale Avatar answered Sep 29 '22 01:09

Van Gale


There is also: django-multilingual

like image 39
Tomasz Zieliński Avatar answered Sep 29 '22 00:09

Tomasz Zieliński