views:

34

answers:

1

In my models, I have two options...when I get to a variable that necessitates a selection menu, I can either use a new class or use "choices"...

ie.

class Title(models.Model):
   title = models.CharField(max_length=4)

   def __unicode__(self):
     return self.title

or

LANG_CHOICES = (
  ('E', 'English'),
  ('F', 'Francais'),
)

Which method would be better for translation in my project?

+1  A: 

I'm not quite sure if I understand your problem. But in django you can translate the whatever textstring you write in your code. You just need to wrap it in a translate function:

from django.utils.translation import ugettext_lazy as _

foo = 'This is a text string that cannot be translated'
bar = _('This is a text string that can be translated')

You need to run django-admin.py makemessages to get django to create a po file for you where you can do your translations. After that you need to run django-admin.py compilemessages to compile it to binary.

There is more info on the subject in the documentation.

googletorp
ahhh...I was wondering how this works exactly. Thanks
Stephen