perf: 优化语言更改

pull/12928/head
ibuler 8 months ago
parent ccbb860de1
commit 6c0299b05a

@ -297,8 +297,7 @@
</h2>
<ul class=" nav navbar-top-links navbar-right">
<li class="dropdown">
<a class="dropdown-toggle login-page-language" data-toggle="dropdown" href="#"
target="_blank">
<a class="dropdown-toggle login-page-language" data-toggle="dropdown" href="#" target="_blank">
<i class="fa fa-globe fa-lg" style="margin-right: 2px"></i>
<span>{{ current_lang.title }}<b class="caret"></b></span>
</a>
@ -378,8 +377,8 @@
<div class="more-login-items">
{% for method in auth_methods %}
<a href="{{ method.url }}" class="more-login-item">
<i class="fa">
<img src="{{ method.logo }}" height="15" width="15"></i> {{ method.name }}
<i class="fa"><img src="{{ method.logo }}" height="15" width="15"/> </i>
{{ method.name }}
</a>
{% endfor %}
</div>

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:da9be1aa1bc652c62b69c5a0feecd6d6b698d96a896af19843e623943622f9e7
size 139087
oid sha256:b431db400fb354892d5f52df1aa95d71f4646567b8f3421b6f254dd431cca5ae
size 139088

@ -1040,8 +1040,8 @@
"StrategyHelpTips": "Identify the unique attributes of assets (such as platforms) based on priority of strategies; when an asset's attribute (like nodes) can be configured to multiple, all Actions of the strategies will be executed.",
"StrategyList": "Policy List",
"StrategyUpdate": "Update the Policy",
"SuEnabled": "Enable switch",
"SuFrom": "Switch From",
"SuEnabled": "Enable SU",
"SuFrom": "SU From",
"Submit": "Submit",
"Success": "Success",
"SuccessAsset": "Successful Assets",
@ -1197,7 +1197,7 @@
"UserProfile": "Profile",
"UserSession": "Asset Sessions",
"UserSetting": "Preference",
"UserSwitchFrom": "Switch from",
"UserSwitchFrom": "SU from",
"UserUpdate": "Update the User",
"Username": "Username",
"UsernamePlaceholder": "Please Enter Username",

@ -6,6 +6,7 @@ from django.conf import settings
from django.http import HttpResponse
from django.http import HttpResponseRedirect, JsonResponse, Http404
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View, TemplateView
@ -32,7 +33,8 @@ class I18NView(View):
def get(self, request, lang):
referer_url = request.META.get('HTTP_REFERER', '/')
response = HttpResponseRedirect(referer_url)
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang)
expires = timezone.now() + timezone.timedelta(days=365)
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang, expires=expires)
return response

Loading…
Cancel
Save