开发者

Paragraph translation in Python/Django

开发者 https://www.devze.com 2023-01-11 20:07 出处:网络
I translated a site using django i18n, I have no problems for menus, little paragraph, etc.. The thing I dont understand is for translating big paragraph. On my site, the admin can write some news by

I translated a site using django i18n, I have no problems for menus, little paragraph, etc.. The thing I dont understand is for translating big paragraph. On my site, the admin can write some news by administration page, 开发者_开发百科but he wants them in differents languages.

I can imagine some methods to do that :

  • one field per langage, but it will be difficult to manage with severals languages (for example news table has title and content, we will have 4 fields ? title_en title_fr content_en content_fr ?
  • update the .po file for each new news ?
  • the real solution ?

What is the best solution for that ?

Thanks ! (sorry for my english)


I'm not 100% sure what you're asking for, but it sounds like you have a model called News that you want to be multilingual aware.

There is a page on the Django wiki that covers some differing approaches to the problem of storing multilingual content in models, including the one you describe of having a field for each language in the model. It also links to a number of different Django apps that attempt to solve the problem.

Based on my experience, I'd take a look at django-datatrans which seems to me to be best-of-breed both in it's approach (one object per language) and feature set.

0

精彩评论

暂无评论...
验证码 换一张
取 消