views:

176

answers:

2

For small portions of text we use django standart {% trans %} tag

What to do with big texts such as FAQ, terms and other static pages

+5  A: 

There is a {% blocktrans %} templatetag you can use.

You could also write a simple templatetag yourself which includes anathor template based on the current language.

{% i18ninclude "faq/question1.html" "en" %}

Would include faq/question1.en.html. Here is the code:

import os
from django import template
register = template.Library()

@register.simpletag
def i18ninclude(template_name, language):
    template_name, extension = os.path.splitext(template_name)
    template_name = '%s.%s%s' % (template_name, language, extension)
    return template.loader.render_to_string(template_name)

Put this in a templatetag library of your app. I also recommend to read the documentation about custom templatetags if you haven't done it yet.

Gregor Müllegger
+2  A: 

Take a look at django-better-chunks. It allows to insert snippets of static HTML inside your templates and it has i18n support.

For static pages I recommend to use some kind of CMS, for example django-cms. It's also i18n-enabled.

Andrey Fedoseev
Thank u for info about django-cms, we start investigate it to consider for it application in our project
UserEcho