Skip to content

Commit

Permalink
add English
Browse files Browse the repository at this point in the history
  • Loading branch information
putianyi889 committed May 26, 2024
1 parent 7bd25fc commit 8f0e7a1
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 25 deletions.
12 changes: 10 additions & 2 deletions front_end/src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { createI18n } from 'vue-i18n'
import { dev } from '@/i18n/locales/dev'
import { zhCn } from '@/i18n/locales/zh-cn'
import { de } from '@/i18n/locales/de'
import { en } from './locales/en'
import { LocaleConfig } from '@/i18n/config'

/**
* 获取所有语言
*/
function getMessages (): Record<string, LocaleConfig> {
const messages: Record<string, LocaleConfig> = {}
function getMessages (): Record<string, any> {
const messages: Record<string, any> = {}
messages[dev.local] = dev
messages[zhCn.local] = zhCn
messages[de.local] = de
messages[en.local] = en
return messages
}

Expand All @@ -22,6 +26,10 @@ function getDefaultLocale () {
if (/^zh(.?CN)?$/i.test(language)) {
// 简体中文,包括 zh 和 zh-CN
return zhCn.local
} else if (language == de.local) {
return de.local
} else if (language == en.local) {
return en.local
}
}
// 默认使用简体中文
Expand Down
15 changes: 2 additions & 13 deletions front_end/src/i18n/locales/de.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

import { LocaleConfig } from '@/i18n/config'

export const dev: LocaleConfig = {
local: 'dev',
export const de = {
local: 'de',
name: 'name',
common: {
time: 'common.time'
},
forgetPassword: {
title: 'Titel',
email: 'E-Mail',
Expand Down Expand Up @@ -44,13 +41,8 @@ export const dev: LocaleConfig = {
profile: {
changeAvatar: 'Profilbild ändern',
realname: 'Name',
realnameInput: 'profile.realnameInput',
signature: 'profile.signature',
signatureInput: 'profile.signatureInput',
change: 'profile.change',
confirmChange: 'Änderungen bestätigen',
cancelChange: 'abbrechen',
designator: 'profile.designator'
},
register: {
title: 'Titel',
Expand All @@ -65,7 +57,4 @@ export const dev: LocaleConfig = {
termsAndConditions: 'Nutzungsbedingungen',
confirm: 'bestätigen'
},
example: {
placeholder: 'example.placeholder: {0}',
},
}
7 changes: 2 additions & 5 deletions front_end/src/i18n/locales/dev.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LocaleConfig } from '@/i18n/config'
//import { LocaleConfig } from '@/i18n/config'

export const dev: LocaleConfig = {
export const dev = {
local: 'dev',
name: 'name',
common: {
Expand Down Expand Up @@ -81,7 +81,4 @@ export const dev: LocaleConfig = {
termsAndConditions: 'register.termsAndConditions',
confirm: 'register.confirm'
},
example: {
placeholder: 'example.placeholder: {0}',
},
}
69 changes: 69 additions & 0 deletions front_end/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export const en = {
local: 'en',
name: 'English',
common: {
level: {
b: 'Beginner',
i: 'Intermediate',
e: 'Expert',
},
mode: {
standard: 'Standard',
noFlag: 'No Flag',
noGuess: 'No Guessing',
recursive: 'Recursive Chord'
},
time: 'Time'
},
forgetPassword: {
title: 'Reset password',
email: 'email',
captcha: 'captcha',
getEmailCode: 'Send one-time password',
emailCode: 'one-time password',
password: 'new password',
confirmPassword: 'confirm password',
confirm: 'Reset'
},
login: {
title: 'Login',
username: 'username',
password: 'password',
captcha: 'captcha',
forgetPassword: 'Forget password?',
keepMeLoggedIn: 'Keep me logged in',
confirm: 'Log in'
},
menu: {
ranking: 'Ranking',
video: 'Videos',
world: 'Statistics',
guide: 'Guides',
score: 'Scores',
profile: 'Profile',
welcome: `Welcome, {0}!`,
login: 'Login',
logout: 'Logout',
register: 'Register',
downloads: 'Downloads',
links: 'Links',
team: 'Team'
},
profile: {
changeAvatar: 'Click the image to change avatar',
realname: 'Name: ',
realnameInput: 'Input your real name here',
signature: 'Bio: ',
signatureInput: 'Input your bio here',
change: 'Edit profile',
confirmChange: 'Confirm',
cancelChange: 'Cancel',
designator: 'My designators: ',
records: {
title: 'Personal Records',
modeRecord: '-mode record: '
},
videos: 'All videos',
upload: 'Upload videos'
},
}
7 changes: 2 additions & 5 deletions front_end/src/i18n/locales/zh-cn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LocaleConfig } from '@/i18n/config'
//import { LocaleConfig } from '@/i18n/config'

export const zhCn: LocaleConfig = {
export const zhCn = {
local: 'zh-cn',
name: '简体中文',
common: {
Expand Down Expand Up @@ -81,7 +81,4 @@ export const zhCn: LocaleConfig = {
termsAndConditions: '元扫雷网用户协议',
confirm: '注册'
},
example: {
placeholder: '占位符: {0}',
},
}

0 comments on commit 8f0e7a1

Please sign in to comment.