From f369ac31b8abc1ca810172401b9e66774580204c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Thu, 20 Feb 2025 11:00:45 +0800 Subject: [PATCH] The app name can only contain letters, numbers and underscores. --- package.json | 2 +- src/lang/en_us.ts | 3 ++- src/lang/ja_jp.ts | 2 +- src/lang/ko_kr.ts | 2 +- src/lang/zh_cn.ts | 2 +- src/lang/zh_tw.ts | 2 +- src/pages/edit.vue | 7 ++++++- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 85c376b6..f03d68dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pakeplus", "private": true, - "version": "0.5.2", + "version": "0.5.3", "type": "module", "scripts": { "dev": "vite", diff --git a/src/lang/en_us.ts b/src/lang/en_us.ts index 7752d9ed..68f0255d 100644 --- a/src/lang/en_us.ts +++ b/src/lang/en_us.ts @@ -31,7 +31,8 @@ export default { urlInvalid: 'The url must start with http', example: 'example', appName: 'AppName', - appNameInvalid: 'The app name cannot start with a digit', + appNameInvalid: + 'The app name can only contain letters, numbers and underscores.', appId: 'Identifier', appIdInvalid: 'The appid must be alphanumeric and dot', appIcon: 'AppIcon', diff --git a/src/lang/ja_jp.ts b/src/lang/ja_jp.ts index cdd622df..0447c1cf 100644 --- a/src/lang/ja_jp.ts +++ b/src/lang/ja_jp.ts @@ -33,7 +33,7 @@ export default { urlInvalid: 'urlはhttpで始まる必要があります', example: '例', appName: 'アプリ名', - appNameInvalid: 'アプリ名は数字で始めることはできません', + appNameInvalid: 'アプリ名は英数字と_で構成されている必要があります', appId: 'アプリID', appIdInvalid: 'アプリIDは英数字と.で構成されている必要があります', appIcon: 'アプリアイコン', diff --git a/src/lang/ko_kr.ts b/src/lang/ko_kr.ts index 2e57b2de..f4f3f755 100644 --- a/src/lang/ko_kr.ts +++ b/src/lang/ko_kr.ts @@ -32,7 +32,7 @@ export default { urlInvalid: 'url은 http로 시작해야 합니다', example: '예', appName: '앱 이름', - appNameInvalid: '앱 이름은 숫자로 시작할 수 없습니다', + appNameInvalid: '앱 이름은 영어 숫자와 _로만 구성되어야 합니다', appId: '앱 ID', appIdInvalid: '앱 ID는 영어 숫자와 .로 구성되어야 합니다', appIcon: '앱 아이콘', diff --git a/src/lang/zh_cn.ts b/src/lang/zh_cn.ts index ecc2e73a..a33c3746 100644 --- a/src/lang/zh_cn.ts +++ b/src/lang/zh_cn.ts @@ -30,7 +30,7 @@ export default { urlInvalid: 'url必须以http开头', example: '例如', appName: 'APP名称', - appNameInvalid: 'APP名称不能以数字开头', + appNameInvalid: 'APP名称只能包含字母、数字和下划线', appId: 'APP标识', appIdInvalid: 'appid必须为字母、数字和.组成', appIcon: 'APP图标', diff --git a/src/lang/zh_tw.ts b/src/lang/zh_tw.ts index 13242df9..50fcda37 100644 --- a/src/lang/zh_tw.ts +++ b/src/lang/zh_tw.ts @@ -30,7 +30,7 @@ export default { urlInvalid: 'url必須以http開頭', example: '例如', appName: 'APP名稱', - appNameInvalid: 'APP名稱不能以數字開頭', + appNameInvalid: 'APP名稱只能包含字母、數字和下劃線', appId: 'APP標識', appIdInvalid: 'appid必須為字母、數字和.組成', appIcon: 'APP圖標', diff --git a/src/pages/edit.vue b/src/pages/edit.vue index e33beec1..75292447 100644 --- a/src/pages/edit.vue +++ b/src/pages/edit.vue @@ -412,7 +412,12 @@ const appRules = reactive({ // console.log('appshow name value', value) // the name cannot start with a digit // the name cannot contain special characters - if (/^[0-9]/.test(value) || value.includes(' ')) { + // the name cannot include chinese characters + if ( + /^[0-9]/.test(value) || + value.includes(' ') || + /[\u4e00-\u9fa5]/.test(value) + ) { callback(new Error(t('appNameInvalid'))) } else { callback()