First time here? Check out the FAQ!
1

LANGUAGE_CODE not applied to manage.py commands
 

I have a translated site where the URL for questions is translated. When I use question.get_absolute_url() within the askbot application, everything works well.

However, if I use it within a command invoked with manage.py, the URL returned is the one for english.

Using the translation.get_language() call, the language is set to 'en-us', even though my settings.py is different. The django settings.LANGUAGE_CODE is correct.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Benoit's avatar
875
Benoit
asked 13 years ago

Comments

see more comments

1 Answer

1

A quick workaround is place this at the beginning of the command:

translate.activate(settings.LANGUAGE_CODE)

Or, maybe put it in manage.py so it takes effect for all commands.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Benoit's avatar
875
Benoit
answered 13 years ago, updated 13 years ago
link

Comments

see more comments