Repository: nextcloud/appstore

Issue:
Make it possible to change your language in the profile
It should be possible to change the language inside my profile view



Discussion:

Resolving patch:
diff --git a/nextcloudappstore/core/user/urls.py b/nextcloudappstore/core/user/urls.py
new file mode 100644
--- /dev/null
+++ b/nextcloudappstore/core/user/urls.py
@@ -0,0 +1,13 @@
+from django.conf.urls import url
+
+from nextcloudappstore.core.user.views import PasswordView, AccountView, \
+    APITokenView, DeleteAccountView, ChangeLanguageView
+
+urlpatterns = [
+    url(r'^$', AccountView.as_view(), name='account'),
+    url(r'^password/?$', PasswordView.as_view(), name='account-password'),
+    url(r'^token/?$', APITokenView.as_view(), name='account-api-token'),
+    url(r'^delete/?$', DeleteAccountView.as_view(), name='account-deletion'),
+    url(r'^change-language/?$', ChangeLanguageView.as_view(),
+        name='account-change-language'),
+]
diff --git a/nextcloudappstore/core/user/views.py b/nextcloudappstore/core/user/views.py
--- a/nextcloudappstore/core/user/views.py
+++ b/nextcloudappstore/core/user/views.py
@@ -10,6 +10,15 @@
 from nextcloudappstore.core.user.forms import DeleteAccountForm
 
 
+class ChangeLanguageView(LoginRequiredMixin, TemplateView):
+    template_name = 'user/set-language.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['acc_page'] = 'account-change-language'
+        return context
+
+
 class DeleteAccountView(LoginRequiredMixin, TemplateView):
     template_name = 'user/delete-account.html'
 
@@ -35,7 +44,7 @@ class AccountView(LoginRequiredMixin, UpdateView):
     template_name_suffix = ''
     model = User
     fields = ['first_name', 'last_name']
-    success_url = reverse_lazy('account')
+    success_url = reverse_lazy('user:account')
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
@@ -54,7 +63,7 @@ class PasswordView(LoginRequiredMixin, PasswordChangeView):
     """Allow the user to change their password."""
 
     template_name = 'user/password.html'
-    success_url = reverse_lazy('account-password')
+    success_url = reverse_lazy('user:account-password')
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
diff --git a/nextcloudappstore/urls.py b/nextcloudappstore/urls.py
--- a/nextcloudappstore/urls.py
+++ b/nextcloudappstore/urls.py
@@ -3,8 +3,6 @@
 from csp.decorators import csp_exempt
 from django.conf.urls import url, include
 from django.contrib import admin
-from nextcloudappstore.core.user.views import PasswordView, AccountView, \
-    APITokenView, DeleteAccountView
 from nextcloudappstore.core.views import CategoryAppListView, AppDetailView, \
     app_description, AppReleasesView, AppUploadView, LegalNoticeView, \
     AppRatingApi
@@ -15,13 +13,6 @@
     url(r"^social/signup/$", csp_exempt(social_signup),
         name="socialaccount_signup"),
     url(r'^', include('allauth.urls')),
-    url(r'^account/?$', AccountView.as_view(), name='account'),
-    url(r'^account/password/?$', PasswordView.as_view(),
-        name='account-password'),
-    url(r'^account/token/?$', APITokenView.as_view(),
-        name='account-api-token'),
-    url(r'^account/delete/?$', DeleteAccountView.as_view(),
-        name='account-deletion'),
     url(r'^legal/?$', LegalNoticeView.as_view(), name='legal-notice'),
     url(r'^categories/(?P<id>[\w]*)/?$', CategoryAppListView.as_view(),
         name='category-app-list'),
@@ -35,5 +26,8 @@
         name='app-ratings'),
     url(r'^api/', include('nextcloudappstore.core.api.urls',
                           namespace='api')),
+    url(r'^account/',
+        include('nextcloudappstore.core.user.urls', namespace='user')),
     url(r'^admin/', admin.site.urls),
+    url(r'^i18n/', include('django.conf.urls.i18n')),
 ]


Test patch: