Writing translatable static web pages using Django

229 Views Asked by At

I am a bit confused on the best way to handle this problem:

My web site needs read-only static web pages (typically the About part of a web site) with 2 simple constraints:

  • they need to be translated
  • they need to have flexible layout: to incorporate base headers/footers, floating images and/or tables, and non-interactive elements (like a bootstrap carousel).

Several solutions that I have thought about:

  • I can of course directly write HTML files but the translation part will be awkward (a lot of <h1>, <ul>, <li> and <p> which are of no interest to the translator).
  • I can use Django flatpages with some markup languages but I lose a lot of flexibility (for instance template tags are not recognized)
  • Use generators like Hyde, but it seems quite overkill for my needs and internationalization seems a bit difficult

Does someone have other propositions that I can look into ?

Thanks !

1

There are 1 best solutions below

2
YardenST On

Use django-cms, it has a Page model that can be translated and has a very smart plugin system to add many content-types into every page.

I use it a lot and it's very easy and yet powerful

For completeness and fairness, here's a full list of available CMS packages for Django.


for a much simpler solution, I would create a model called "Page" with lets say title and text fields.

The title and the text fields I would register to django-modeltranslation which will handle the translation issue.

For the text field i would use TinyMCE which let you insert basically any HTML you want so you can do whatever you need.