mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
locale: Adds preferred language for logged in user
- UserProfile model is created, it has one-to-one relationship with User. - Language selection dropdown added to UserCreate and UserUpdate forms. - Adds None to language selection dropdown to explicitly unselect. - LANGUAGE_SESSION_KEY is set to User's preferred language on LogIn activity. - LANGUAGE_SESSION_KEY is deleted on User's LogOut activity. Signed-off-by: Sai Kiran Naragam <saikiran.rguiiit@gmail.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
1 parent
5cff5629d8
commit
837e0b8384
7 files changed
+82
-8
No files matched your search
+2
-2
@@ -60,7 +60,7 @@ class LanguageSelectionForm(forms.Form):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
supported_languages = []
|
||||
supported_languages = [(None, '-----------')]
|
||||
for language_code, language_name in settings.LANGUAGES:
|
||||
locale_code = translation.to_locale(language_code)
|
||||
plinth_dir = os.path.dirname(plinth.__file__)
|
||||
@@ -70,4 +70,4 @@ class LanguageSelectionForm(forms.Form):
|
||||
|
||||
self.fields['language'].choices = supported_languages
|
||||
|
||||
language = forms.ChoiceField(label='Language', choices=[])
|
||||
language = forms.ChoiceField(label='Language', choices=[], required=False)
|
||||
Reference in new issue
Block a user