mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
display chinese character alert
This commit is contained in:
parent
73a3d173e8
commit
a55db33f42
@ -79,5 +79,7 @@
|
|||||||
"stableInstall": "Download",
|
"stableInstall": "Download",
|
||||||
"devInstall": "Download",
|
"devInstall": "Download",
|
||||||
|
|
||||||
"updateNotifText": "A new update is available! Newest version: "
|
"updateNotifText": "A new update is available! Newest version: ",
|
||||||
|
|
||||||
|
"chineseCharacterAlert": "The file path set contains Chinese characters, this may cause problems!"
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,8 @@ async function openGrasscutterFolder() {
|
|||||||
|
|
||||||
// https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html
|
// https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html
|
||||||
function hasChineseChars(str) {
|
function hasChineseChars(str) {
|
||||||
let re1 = new RegExp(/^[\u4E00-\uFA29]*$/) //Chinese character range
|
let re1 = new RegExp(/[\u4E00-\uFA29]/) //Chinese character range
|
||||||
let re2 = new RegExp(/^[\uE7C7-\uE7F3]*$/) //non Chinese character range
|
let re2 = new RegExp(/[\uE7C7-\uE7F3]/) //non Chinese character range
|
||||||
str = str.replace(/\s/g, '')
|
str = str.replace(/\s/g, '')
|
||||||
|
|
||||||
if (!re1.test(str) || re2.test(str)) {
|
if (!re1.test(str) || re2.test(str)) {
|
||||||
|
@ -411,6 +411,7 @@ async function setGameExe() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!gameExe[0]) return
|
if (!gameExe[0]) return
|
||||||
|
if (hasChineseChars(gameExe[0])) displayAlert(localeObj.chineseCharacterAlert)
|
||||||
|
|
||||||
// Set the folder in our configuration
|
// Set the folder in our configuration
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
@ -434,6 +435,7 @@ async function setGrasscutterFolder() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!folder[0]) return
|
if (!folder[0]) return
|
||||||
|
if (hasChineseChars(folder[0])) displayAlert(localeObj.chineseCharacterAlert)
|
||||||
|
|
||||||
// Set the folder in our configuration
|
// Set the folder in our configuration
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user