Files
aaPanel/class/userLang.py
T
Jack e65107a251 Update to v7.37.0
1. Added: USDT payment method (please contact customer service via email for payment)
2. Added: Russian language support
3. Added: Domains - Provider List added PorkBun, NameSilo
4. Added: Domains - SSL Certificate - Added Business Certificate
5. Added: Domains - SSL Certificate - Apply for SSL added file verification
6. Added: Setting - Panel SSL added file verification
7. Added: WP Toolkit - Create site with auto DNS resolution
8. Added: FTP - Log and Log analytics support for Ubuntu and Debian
9. Added: Website/WP Toolkit option to choose whether to create default HTML file when adding sites
10. Added: Automatic Daemon tasks: Nginx, Apache, FTP, Redis, MySQL, Memcached, etc.
11. Added: Brute force protection compatible with 2 log formats
12. Optimized: Brute force protection history records now display in reverse chronological order
13. Optimized: Brute force protection settings added unblock time notification for IP blocking configuration
14. Optimized: Website/WP Toolkit SSL interface
15. Optimized: Cron automatic backup with retry mechanism for remote uploads
16. Optimized: Pay interface
17. Fixed: Temporary login Fixed blank page issue
18. Fixed: Mail Server Fixed missing MX record auto-configuration issue
19. Fixed: Node projects occasionally failing to retrieve running status
20. Fixed: Issue where Account could not be confirmed after editing in some cases
21. Fixed #225
2025-05-23 19:30:26 +08:00

122 lines
4.0 KiB
Python

#coding: utf-8
# +-------------------------------------------------------------------
# | aaPanel
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2099 aaPanel(www.aapanel.com) All rights reserved.
# +-------------------------------------------------------------------
# | Author: lotk
# | 登录处设置语言
# +-------------------------------------------------------------------
import public,os,sys,db,time,json,re
from BTPanel import session,cache,json_header
from flask import request,redirect,g
from Crypto import Random
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher
import base64
try:
from BTPanel import cache, session
except:
pass
class userLang:
# 获取语言选项
def get_language(self, post):
settings = '{}/BTPanel/languages/settings.json'.format(public.get_panel_path())
custom = '{}/BTPanel/static/vite/lang/my-MY'.format(public.get_panel_path())
if not os.path.exists(settings):
data = {
"default": "en",
"languages": [
{
"name": "cht",
"google": "zh-tw",
"title": "繁體中文",
"cn": "繁體中文"
},
{
"name": "en",
"google": "en",
"title": "English",
"cn": "英语"
},
{
"name": "de",
"google": "de",
"title": "Deutsch",
"cn": "德语"
},
{
"name": "fra",
"google": "fr",
"title": "Français",
"cn": "法语"
},
{
"name": "spa",
"google": "es",
"title": "Español",
"cn": "西班牙语"
},
{
"name": "pt",
"google": "pt",
"title": "Português",
"cn": "葡萄牙语"
},
{
"name": "vie",
"google": "vi",
"title": "Tiếng Việt",
"cn": "越南语"
},
{
"name": "ind",
"google": "id",
"title": "Bahasa Indonesia",
"cn": "印尼语"
}, {
"name": "ru",
"google": "ru",
"title": "Русский",
"cn": "俄语"
}
]
}
public.writeFile(settings, json.dumps(data))
data = json.loads(public.readFile(settings))
if os.path.exists(custom):
data['languages'].append({
"name": "my",
"google": "my",
"title": "Custom",
"cn": "自定义"
})
# 刚安装使用默认值
if data['default']=="":
data['default'] = 'en'
return public.return_message(0, 0, data)
# 设置语言偏好
def set_language(self, post):
if not hasattr(post, 'name'):
return
name = post.name
if name == "":
return
# 登录阶段不设置 只记录
path = "/www/server/panel/BTPanel/languages/language.pl"
public.WriteFile(path, name)
public.set_module_logs('language', 'login_set_language', 1)
return public.return_message(0, 0, public.lang('The setup was successful'))
# 获取当前设置的语言