9

I was reading the django article on form validatin here and i came across this

ValidationError(_('Invalid value'), code='invalid')

my question is what does the _('Invalid value') does?

amdorra
  • 1,536
  • 9
  • 18
  • 1
    possible duplicate of [Mercurial/Python - What Does The Underscore Function Do?](http://stackoverflow.com/questions/3077227/mercurial-python-what-does-the-underscore-function-do) – juankysmith Aug 26 '13 at 13:14

2 Answers2

10

it's for translation purpose

you should see this at the begining of the script

from django.utils.translation import ugettext as _

you can see a complete explanation in the doc

Aamir Rind
  • 38,793
  • 23
  • 126
  • 164
2

_ is often associated with internationalization

might be duplication of Mercurial/Python - What Does The Underscore Function Do?

Community
  • 1
  • 1
a14m
  • 7,808
  • 8
  • 50
  • 67