What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Feb 19, 2007 by djnesh
Labels: Featured
TranslationService  

Translation service

Translation tags which work with data stored in the database.

Why another translation service?

Current i18n implementation is great for static messages, but is unusable to translate messages from the database. I previously used separate tables for any translatable field in the model, but this is complicated and performance hungry method (not to mention that lots of messages gets duplicated).

With the coming of magic-removal branch and new features like event system I decided to go for the another approach - make something like gettext which will translate and use data from the database, and here are the results.

Features

Wish list

Feel free to add your own...

Installation

See: AppInst for install instructions.

Then, in your templates use it like this:

{% load nesh.translation %}
{% translate object.field %}

Requirements

Current status

I'm added I18NCharField and I18NTextField which will take advantage of new magic removal event system to automatically add/change/delete message registry when field is changed. ''This is not required for translation usage, just as a helper''.

Also, first take of message registry is implemented.

Fields

Basicaly this fields are same as corresponding parent fields with added functionality.

This fields will not add anything to the admin interface or add additional models like my old I18N fields, main goal of this app is to stop explosion of additional tables needed for translation.

Tags

Both translate tags works like this:

translate

Based on i18n trans tag.

Usage:

{% translate object.field %}

blocktranslate

This will translate a block of text with parameters.

Usage:

{% blocktranslate with object.field|filter as bar and object.field2|filter as boo %}
This is {{ bar }} and {{ boo }}.
{% endblocktranslate %}

Based on i18n blocktrans tag.


Sign in to add a comment