Django validation error messages are always shown in English when running unit tests
|Reported by:||denilsonsa||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
How to reproduce:
- Start a new project and set LANGUAGE_CODE to something other than 'en-us'. For instance, let's put 'pt-br'.
- Create a view that renders a bounded form.
- Pass invalid data to that form, so that the form will output some (django built-in) validation error messages.
- Look at the error message at the browser. Notice it is in Portuguese (or whatever language you have set).
- Now write a unit test that checks if your view actually shows that error message.
- BOO! The test fails! When running unit tests, the django error messages are shown in English, ignoring the LANGUAGE_CODE setting.
I'm attaching a tarball with a minimalistic project showing this bug.
In my opinion, django should behave the same whenever running as server or running the unit tests. Thus, I believe this behavior is a bug.
Tested against Django 1.2.4