Opened 4 years ago

Last modified 4 years ago

#15143 new New feature

Add precisions about setting the language for the test client

Reported by: claudep Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords:
Cc: poswald Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I suggest to add a note in the documentation about how to set the language for the test client.

Without the LocaleMiddleware, it's possible to set it with the activate/deactivate functions from django.utils.translation.

When LocaleMiddleware is activated, another method has to be used, otherwise the settings.LANGUAGE_CODE is always used. I've been able to set the language by passing HTTP_ACCEPT_LANGUAGE='de' to the get/post method, or by loading a cookie (client.cookies.load({settings.LANGUAGE_COOKIE_NAME:'de'})).

Change History (5)

comment:1 Changed 4 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

BTW, the activate/deactivate functions from django.utils.translation aren't documented either.

comment:2 Changed 4 years ago by poswald

  • Cc poswald added

comment:3 Changed 4 years ago by lrekucki

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

Note: See TracTickets for help on using tickets.
Back to Top