Skip to content

Commit

Permalink
fix(useNodeConfig.ts): adapt to English language
Browse files Browse the repository at this point in the history
  • Loading branch information
oucb committed Nov 25, 2023
1 parent 012465e commit 68310ae
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/composables/config/useNodeConfig.ts
Original file line number Diff line number Diff line change
@@ -154,6 +154,16 @@ export default (props: Props) => {

const schemName = pluginMsgIdMap[pluginName.value]?.schema || nodePluginToLower
const { data } = await queryPluginConfigInfo(schemName)
if (schemName === 'gewu' && data.operator && data.operator.valid) {
const validData: Array<any> = [
{ key: '$config.gewuOperator1', value: 0 },
{ key: '$config.gewuOperator2', value: 1 },
{ key: '$config.gewuOperator3', value: 2 },
{ key: '$config.gewuOperator4', value: 3 },
{ key: '$config.gewuOperator5', value: 4 },
]
data.operator.valid = { map: validData }
}
const pluginInfo: PluginInfo = data

if (!pluginInfo) {
4 changes: 4 additions & 0 deletions src/composables/config/useNodeConfigParamCommon.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import i18n from '@/i18n/index'
import type { ParamInfo } from '@/types/config'
import { dataType } from '@/utils/utils'
import { TypeOfPluginParam, SchameBase } from '@/types/enums'
@@ -57,6 +58,9 @@ export default () => {
}

const upperFirstLetter = (str: string) => {
if (str.startsWith('$') && str.indexOf('.')) {
return i18n.global.t(str.split('$')[1])
}
if (LOWERCASE_INITIAL_REGEX.test(str)) {
return str.slice(0, 1).toUpperCase() + str.slice(1)
}
20 changes: 20 additions & 0 deletions src/i18n/config.ts
Original file line number Diff line number Diff line change
@@ -646,4 +646,24 @@ export default {
zh: '注册的设备,名称只能包含数字和字母',
en: 'Subscribed devices, names can only contain numbers and letters',
},
gewuOperator1: {
zh: '未使用蜂窝网络',
en: 'Not using cellular network',
},
gewuOperator2: {
zh: '联通',
en: 'China Unicom',
},
gewuOperator3: {
zh: '移动',
en: 'China Mobile',
},
gewuOperator4: {
zh: '电信',
en: 'China Telecom',
},
gewuOperator5: {
zh: '广电',
en: 'China Broadnet',
},
}

0 comments on commit 68310ae

Please sign in to comment.