mirror of https://github.com/snachodog/mybuddy.git
Ensure "settings saved" is translated (#346)
This commit is contained in:
parent
c28620b3d8
commit
0250faec6e
|
@ -6,6 +6,7 @@ from django.contrib.auth.models import User
|
||||||
from django.contrib.messages.views import SuccessMessageMixin
|
from django.contrib.messages.views import SuccessMessageMixin
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
|
from django.utils import translation
|
||||||
from django.utils.text import format_lazy
|
from django.utils.text import format_lazy
|
||||||
from django.utils.translation import gettext as _, gettext_lazy
|
from django.utils.translation import gettext as _, gettext_lazy
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
@ -144,7 +145,9 @@ class UserSettings(LoginRequiredMixin, View):
|
||||||
user_settings = form_settings.save(commit=False)
|
user_settings = form_settings.save(commit=False)
|
||||||
user.settings = user_settings
|
user.settings = user_settings
|
||||||
user.save()
|
user.save()
|
||||||
|
translation.activate(user.settings.language)
|
||||||
messages.success(request, _('Settings saved!'))
|
messages.success(request, _('Settings saved!'))
|
||||||
|
translation.deactivate()
|
||||||
return set_language(request)
|
return set_language(request)
|
||||||
return render(request, self.template_name, {
|
return render(request, self.template_name, {
|
||||||
'user_form': form_user,
|
'user_form': form_user,
|
||||||
|
|
Loading…
Reference in New Issue