Skip to content

Commit e2951f8

Browse files
authored
Merge pull request eee555#55 from putianyi889/patch-40
实装波兰语本地化
2 parents 4b9a230 + 04da0d2 commit e2951f8

File tree

9 files changed

+134
-13
lines changed

9 files changed

+134
-13
lines changed

back_end/saolei/saolei/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
ROOT_URLCONF = "saolei.urls"
7676

77-
RATELIMIT_VIEW = "utils.ratelimited"
77+
RATELIMIT_VIEW = "utils.response.ratelimited_error"
7878

7979
TEMPLATES = [
8080
{

back_end/saolei/utils/response.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from django.http import HttpResponse
2+
3+
def ratelimited_error(request, exception):
4+
return HttpResponse(status=429)

front_end/src/components/LanguagePicker.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const options = [
2424
{ lang: "zh-cn", text: "简体中文" },
2525
{ lang: "en", text: "English" },
2626
{ lang: "de", text: "name" },
27+
{ lang: "pl", text: "polski"},
2728
{ lang: "dev", text: "dev" },
2829
];
2930
@@ -39,8 +40,9 @@ const changeLanguage = (value: any) => {
3940

4041
<style lang="less" scoped>
4142
.icon {
42-
margin-top: v-bind("local.menu_height / 4 + 'px'");
43-
margin-bottom: v-bind("local.menu_height / 4 + 'px'");
43+
margin-top: v-bind("(local.menu_height - local.menu_font_size) / 2 + 'px'");
44+
min-width: v-bind("local.menu_font_size + 'px'");
45+
height: v-bind("local.menu_font_size + 'px'");
4446
cursor: pointer;
4547
}
4648
</style>

front_end/src/i18n/config.ts

+71-6
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,71 @@ export type LocaleConfig = LocaleMessage<VueMessageType> & {
1010
// 嵌套配置示例 TODO 删除嵌套配置示例
1111
name: string,
1212
common: {
13+
action: {
14+
getSoftware: string,
15+
getUserProfile: string,
16+
setUserProfile: string,
17+
uploadFile: string,
18+
videoQuery: string,
19+
},
20+
hide: string,
1321
level: {
1422
b: string,
1523
i: string,
1624
e: string,
1725
},
1826
mode: {
19-
standard: string,
20-
noFlag: string,
21-
noGuess: string,
22-
recursive: string
27+
std: string,
28+
nf: string,
29+
ng: string,
30+
dg: string,
2331
}
32+
msg: {
33+
actionFail: string,
34+
actionSuccess: string,
35+
agreeTAC: string,
36+
confirmPasswordFail: string,
37+
connectionFail: string,
38+
emailCodeSent: string,
39+
emptyEmail: string,
40+
emptyEmailCode: string,
41+
emptyPassword: string,
42+
emptyUsername: string,
43+
fileTooLarge: string,
44+
invalidEmail: string,
45+
invalidEmailCode: string,
46+
invalidPassword: string,
47+
invalidUsername: string,
48+
logoutFail: string,
49+
logoutSuccess: string,
50+
realNameRequired: string,
51+
},
2452
prop: {
2553
action: string,
2654
designator: string,
2755
fileName: string,
56+
is: string,
57+
op: string,
2858
level: string,
59+
realName: string,
60+
sex: string,
2961
status: string,
3062
time: string,
63+
timems: string,
64+
upload_time: string,
3165
}
66+
response: {
67+
OK: '',
68+
BadRequest: string,
69+
Forbidden: string,
70+
InternalServerError: string,
71+
NotFound: string,
72+
PayloadTooLarge: string,
73+
TooManyRequests: string,
74+
UnsupportedMediaType: string,
75+
},
76+
show: string,
77+
toDo: string,
3278
},
3379
forgetPassword: {
3480
title: string,
@@ -38,7 +84,8 @@ export type LocaleConfig = LocaleMessage<VueMessageType> & {
3884
emailCode: string,
3985
password: string,
4086
confirmPassword: string,
41-
confirm: string
87+
confirm: string,
88+
success: string,
4289
},
4390
login: {
4491
title: string,
@@ -60,6 +107,7 @@ export type LocaleConfig = LocaleMessage<VueMessageType> & {
60107
login: string,
61108
logout: string,
62109
register: string,
110+
setting: string,
63111
downloads: string,
64112
links: string,
65113
team: string
@@ -74,6 +122,13 @@ export type LocaleConfig = LocaleMessage<VueMessageType> & {
74122
confirmChange: string,
75123
cancelChange: string,
76124
designator: string,
125+
msg: {
126+
avatarChange: string,
127+
avatarFormat: string,
128+
avatarFilesize: string,
129+
realnameChange: string,
130+
signatureChange: string,
131+
},
77132
records: {
78133
title: string,
79134
modeRecord: string
@@ -110,6 +165,16 @@ export type LocaleConfig = LocaleMessage<VueMessageType> & {
110165
confirmPassword: string,
111166
agreeTo: string,
112167
termsAndConditions: string,
113-
confirm: string
168+
confirm: string,
169+
},
170+
setting: {
171+
appearance: string,
172+
darkMode: string,
173+
languageSwitch: string,
174+
menuFontSize: string,
175+
menuHeight: string,
176+
menuLayout: string,
177+
menuLayoutAbstract: string,
178+
menuLayoutDefault: string,
114179
},
115180
}

front_end/src/i18n/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { dev } from '@/i18n/locales/dev'
33
import { zhCn } from '@/i18n/locales/zh-cn'
44
import { de } from '@/i18n/locales/de'
55
import { en } from './locales/en'
6+
import { pl } from './locales/pl'
67

78
/**
89
* 获取所有语言
@@ -13,6 +14,7 @@ function getMessages (): Record<string, any> {
1314
messages[zhCn.local] = zhCn
1415
messages[de.local] = de
1516
messages[en.local] = en
17+
messages[pl.local] = pl
1618
return messages
1719
}
1820

front_end/src/i18n/locales/en.ts

+50-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
import { LocaleConfig } from '@/i18n/config'
2+
13
export const en = {
24
local: 'en',
35
name: 'English',
46
common: {
7+
action: {
8+
getSoftware: 'fetch video data',
9+
getUserProfile: 'fetch user data',
10+
setUserProfile: 'modify user data',
11+
uploadFile: 'upload file',
12+
videoQuery: 'fetch video data',
13+
},
514
hide: 'Hide',
615
level: {
716
b: 'Beginner',
@@ -15,6 +24,8 @@ export const en = {
1524
dg: 'Recursive Chord'
1625
},
1726
msg: {
27+
actionFail: 'Failed to {0}',
28+
actionSuccess: 'Succeed to {0}',
1829
agreeTAC: 'Please agree to Terms and Conditions!',
1930
confirmPasswordFail: 'Passwords do not match!',
2031
connectionFail: 'Connection Fails!',
@@ -23,15 +34,19 @@ export const en = {
2334
emptyEmailCode: 'Please enter 6-char email code!',
2435
emptyPassword: 'Please enter your password!',
2536
emptyUsername: 'Please enter your username!',
37+
fileTooLarge: 'Maximum file size is {0}',
2638
invalidEmail: 'Invalid email!',
2739
invalidEmailCode: 'Email code is invalid! Please re-sent your email code.',
2840
invalidPassword: 'The length of password should be from 6 to 20!。',
2941
invalidUsername: 'The length of username cannot exceed 20!',
3042
logoutFail: 'Failed to log out!',
3143
logoutSuccess: 'Log out success!',
44+
realNameRequired: 'Real name required',
3245
},
3346
prop: {
3447
action: 'Action',
48+
designator: 'Designator',
49+
fileName: 'File name',
3550
is: 'Island',
3651
level: 'Level',
3752
op: 'Opening',
@@ -42,18 +57,29 @@ export const en = {
4257
timems: 'Time',
4358
upload_time: 'Upload time',
4459
},
60+
response: {
61+
OK: '',
62+
BadRequest: 'Unrecognised request',
63+
Forbidden: 'Permission denied',
64+
InternalServerError: 'Internal server error',
65+
NotFound: 'Data not found',
66+
PayloadTooLarge: 'Payload too large',
67+
TooManyRequests: 'Too many requests',
68+
UnsupportedMediaType: 'Unsupported file type',
69+
},
4570
show: 'Show',
4671
toDo: 'TODO',
4772
},
4873
forgetPassword: {
4974
title: 'Reset password',
50-
email: 'email',
5175
captcha: 'captcha',
52-
getEmailCode: 'Send one-time password',
76+
confirm: 'Reset',
77+
confirmPassword: 'confirm password',
78+
email: 'email',
5379
emailCode: 'one-time password',
80+
getEmailCode: 'Send one-time password',
5481
password: 'new password',
55-
confirmPassword: 'confirm password',
56-
confirm: 'Reset'
82+
success: 'Password reset complete!'
5783
},
5884
login: {
5985
title: 'Login',
@@ -90,6 +116,13 @@ export const en = {
90116
confirmChange: 'Confirm',
91117
cancelChange: 'Cancel',
92118
designator: 'My designators: ',
119+
msg: {
120+
avatarChange: 'Avatar change complete! {0} times left',
121+
avatarFormat: 'Avatar file has to be in JPG or PNG format!',
122+
avatarFilesize: 'Maximum file size is 50MB!',
123+
realnameChange: 'Real name change complete! {0} times left',
124+
signatureChange: 'Signature change complete! {0} times left',
125+
},
93126
records: {
94127
title: 'Personal Records',
95128
modeRecord: ' mode record: '
@@ -115,6 +148,19 @@ export const en = {
115148
}
116149
}
117150
},
151+
register: {
152+
title: 'Register',
153+
username: 'username',
154+
email: 'email',
155+
captcha: 'captcha',
156+
getEmailCode: 'Send email code',
157+
emailCode: 'email code',
158+
password: 'password',
159+
confirmPassword: 'confirm password',
160+
agreeTo: 'Agree to ',
161+
termsAndConditions: 'Terms & Conditions',
162+
confirm: 'Register',
163+
},
118164
setting: {
119165
appearance: 'Appearance',
120166
darkMode: 'Dark Mode',
File renamed without changes.

front_end/src/i18n/locales/zh-cn.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const zhCn = {
6464
InternalServerError: '后端发生错误',
6565
NotFound: '找不到数据',
6666
PayloadTooLarge: '文件过大',
67+
TooManyRequests: '请求过于频繁',
6768
UnsupportedMediaType: '不支持的文件类型',
6869
},
6970
show: '显示',

front_end/src/utils/system/status.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const notificationMessage: { [code: number]: string} = {
1111
404: 'common.response.NotFound',
1212
413: 'common.response.PayloadTooLarge',
1313
415: 'common.response.UnsupportedMediaType',
14+
429: 'common.response.TooManyRequests',
1415
500: 'common.response.InternalServerError',
1516
};
1617

0 commit comments

Comments
 (0)