> Is there some general suggestion we're to follow, for translating
> values stored in the db?


Unless your project's grand vision only supports a fixed number
of languages ("we will only support English, Spanish, French, and
German...ever"), then you'll need a translation table.

class Translations(Model):
  source = CharField(...)
  language = CharField(...)
  translation = CharField(...)
  class Meta:
    unique_together = (('source', 'language'),)

You can then create a translate() helper function, something like

def translate(s, lang):
  try:
    return Translations.objects.get(
      source=s, language=lang)
  except:
    return s

It's not very efficient, as it requires a DB query for every
translation.  With a little SQL mojo, this could be reduced to a
single hit with a Big Ugly Query (tm), but that gets unwieldy
really quickly.  Depends on the expected site traffic.

There are also maint. considerations...who gets to maintain all
these translations into all your languages?

-tim





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to