akaihola wrote:
>> If I understood docs correctly this is now possible in m-r branch.
>
> Sounds interesting! Which part of the docs?
Ooooops, my error, no docs. Sorry for misleading post :(
I mostly got this from M2M field usage, and with all the talk of "removing the
magic" I presumed that I can also use
same functionality to make my custom fields. But, after (brief) looking through
the code I failed to find any reference
how this can be done so I post here in the hope that some of the core
developers can shed some light on this.
> Wouldn't you need to specify the translated field in the i18n_for_foo
> table as well? For example an Article object would need translations
> for both the title and the content.
Well, every I18NXXXXField will create a separate table, so more accurate
example is:
class Foo(models.Model):
bar = I18NCharField(...)
baz = I18NTextField(...)
to create Foo model and a additional tables like this:
class i18n_for_foo_bar(models.Model):
parent = models.ForeignKey(Foo, edit_inline=True)
language = ...
text = ...
class i18n_for_foo_baz(models.Model):
parent = models.ForeignKey(Foo, edit_inline=True)
language = ...
text = ...
OTOH, I'm currently working on different type of translation service with
centralized message storage (to trim down
number of tables involved which is a major disadvantage of the above method)
for the dynamic content (static is already
handled with gettext) - rough draft is at
http://svn.djangoutils.python-hosting.com/trunk/nesh/translation.
This approach has advantage that no change to the model is involved - just use
main text/char fields as normal, and
translate to the current language in template, just like with gettext. Still, I
must find some way to add new messages
and delete unused one from catalog automatically (adding is not a problem, but
finding witch message to delete is
another story).
My current project have a lots of the translatable data in the database so I
must find some solution that is easy to use
for me (as a developer) and also for end-users which will add and translate
content.
--
Nebojša Đorđević - nesh
Studio Quattro - Niš - SCG
http://studioquattro.biz/
http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ |
http://djangoutils.python-hosting.com/
Registered Linux User 282159 [http://counter.li.org]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---