Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to localize Content of a Django application

Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole site should be localized, i must provide a way of translating theses names and descriptions to the users.

Is there a natural way in django to do this? Or do i have to realize it as part of the application (by representing the translations in the datamodel)

Thanks, Janosch

like image 239
Janosch Avatar asked Dec 14 '08 18:12

Janosch


2 Answers

I would suggest checking out django-multilingual. It is a third party app that lets you define translation fields on your models.

Of course, you still have to type in the actual translations, but they are stored transparently in the database (as opposed to in static PO files), which is what I believe you are asking about.

like image 101
prairiedogg Avatar answered Nov 02 '22 20:11

prairiedogg


I use django-multilingual for localize content and django-localeurl for choosing language based on url (for example mypage/en/).

You can see how multilingua and localeurl work on JewishKrakow.net page.

like image 29
Marcin Mierzejewski Avatar answered Nov 02 '22 21:11

Marcin Mierzejewski