aboutsummaryrefslogtreecommitdiffstats
path: root/docs/topics
diff options
context:
space:
mode:
authorCraig Blaszczyk2014-12-26 12:52:17 +0000
committerCraig Blaszczyk2015-01-02 11:07:58 +0000
commit2781903a5a0be7f5314de54ff2dbc8ef393eab0a (patch)
tree6904305c8345922c1959a76d2ba3530cccd735c1 /docs/topics
parent7ad7dd6a4292157ed5bcbaacb60b6ccc93fcf201 (diff)
downloaddjango-rest-framework-2781903a5a0be7f5314de54ff2dbc8ef393eab0a.tar.bz2
Add info about how django chooses which language to use
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/internationalisation.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/topics/internationalisation.md b/docs/topics/internationalisation.md
index 552fdd27..a0aab753 100644
--- a/docs/topics/internationalisation.md
+++ b/docs/topics/internationalisation.md
@@ -40,4 +40,22 @@ This guide assumes you are already familiar with how to translate a Django app.
6. Restart your server
+
+## How Django chooses which language to use
+REST framework will use the same preferences to select which language to display as Django does. You can find more info in the [django docs on discovering language preferences][django-language-preference]. For reference, these are
+
+1. First, it looks for the language prefix in the requested URL
+2. Failing that, it looks for the `LANGUAGE_SESSION_KEY` key in the current user’s session.
+3. Failing that, it looks for a cookie
+4. Failing that, it looks at the `Accept-Language` HTTP header.
+5. Failing that, it uses the global `LANGUAGE_CODE` setting.
+
+---
+
+**Note:** You'll need to include the `django.middleware.locale.LocaleMiddleware` to enable any of the per-request language preferences.
+
+---
+
+
[django-translation]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation
+[django-language-preference]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#how-django-discovers-language-preference