title: Django Multilanguage on Models and Templates
body: <p>I've watched many solutions for working with models in multilanguage. But none of them it's easy enough to apply, including that doesn't work with south.
  The apps that I watched was obtained from:</p>
  
  <ul>
  <li><a href="http://goodcode.io/blog/django-multilanguage/" rel="nofollow">http://goodcode.io/blog/django-multilanguage/</a></li>
  <li><a href="http://and-other-things.blogspot.com/2009/04/list-of-django-multilingual-model.html" rel="nofollow">http://and-other-things.blogspot.com/2009/04/list-of-django-multilingual-model.html</a></li>
  </ul>
  
  <p>Well, I try a solution for my own with KISS (Keep It simple Stupid) in mind and this is my analysis and solution, based on my specific needs (Only two languages, Spanish as default language):</p>
  
  <ol>
  <li><p>I can create the fields from specific language because I will work only with english and spanish, and it's pretty straightforward</p>
  
  <pre><code>class Country(models.Model):
      name = models.CharField('Pais', max_length=80)
      name_en = models.CharField('Country', max_length=80, blank=True, null=True)
  
      class Meta:
          verbose_name = 'Pais'
          verbose_name_plural = 'Paises'
  
      def __unicode__(self):
          return self.name
  </code></pre></li>
  <li><p>I can create a custom template tag that give me the desired field:</p>
  
  <pre><code>@register.tag(name='get_model_translate')
      def do_translation(parser, token):
          try:
              tag_name, o_model, field = token.split_contents()
          except ValueError:
              raise template.TemplateSintaxError(u'Los parámetros no son válidos')
  
          return Translate(tag_name, o_model, field)
  
  class Translate(template.Node):
  
      def __init__(self, tag_name, o_model, field):
          self.tag_name = tag_name
          self.o_model = template.Variable(o_model)
          self.field = field
  
      def render(self, context):
          lang_code = context.get('request').LANGUAGE_CODE
  
          o_model = self.o_model.resolve(context)
          try:
              data = o_model.__getattribute__('%s_%s' % (self.field, lang_code))
          except Exception, e:
              try:
                  data = o_model.__getattribute__('%s' % self.field)
              except Exception, e:
                  data = ''
  
          return data
  </code></pre></li>
  <li><p>I can pass the desired data from the view to the template</p>
  
  <pre><code>response['country'] = Country.objects.get(pk=1)
  </code></pre></li>
  <li><p>And I can call it like this, asumming that I have the LANGUAGE_CODE in my request context:</p>
  
  <pre><code>{% get_model_translate country name %}
  </code></pre></li>
  </ol>
  
  <p>So, my question is:
  ¿Is this a good approach? I think that the only problem that I see is a <strong>performance</strong> one, but I'm not pretty sure about that, looking for the solutions that others have done.</p>
  
  <p>Thanks for any advise</p>