#28636 - Translation language preference without restriction to `settings.LANGUAGES`

25 views
Skip to first unread message

Denis Anuschewski

unread,
Sep 30, 2017, 12:20:05 PM9/30/17
to Django developers (Contributions to Django itself)
Here is the PR.

I think it would be beneficial to have an optional boolean flag in order to check the language preference against `LANG_INFO` rather than `settings.LANGUAGES`. It would allow one e.g. to get the preference and add a translation fallback for specific languages (with a custom LocaleMiddleware), e.g. when it differs from `settings.LANGUAGE_CODE`. Currently it's not possible when you get a language that is not listed in `settings.LANGUAGES`, because then you always get `settings.LANGUAGE_CODE`, which is not the wanted result in such a use case.

Or is there another way for achieving this without modifying the django core? Overwriting `settings.LANGUAGES` didn't work for me because it activated translation for all languages (I just want a fallback).
Reply all
Reply to author
Forward
0 new messages