mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-21 14:48:33 +00:00
foreign char alert
This commit is contained in:
parent
8951974633
commit
a73c3ed5cd
@ -12,6 +12,7 @@
|
||||
"no-undef": 0,
|
||||
"no-unused-vars": 0,
|
||||
"no-case-declarations": 0,
|
||||
"no-control-regex": 0,
|
||||
|
||||
"indent": [
|
||||
"error",
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
"updateNotifText": "A new update is available! Newest version: ",
|
||||
|
||||
"chineseCharacterAlert": "The file path set contains Chinese characters, this may cause problems!",
|
||||
"foreignCharacterAlert": "The file path set contains foreign characters, this may cause problems!",
|
||||
|
||||
"dialogOk": "OK",
|
||||
"dialogNo": "NO",
|
||||
|
@ -81,5 +81,5 @@
|
||||
|
||||
"updateNotifText": "नया अपडेट आया है! नया वर्शन: ",
|
||||
|
||||
"chineseCharacterAlert": "इस फाइल पथ में चीनी चरक्टेर्स हैं, यह समस्या दे सकता है!"
|
||||
"foreignCharacterAlert": "इस फाइल पथ में चीनी चरक्टेर्स हैं, यह समस्या दे सकता है!"
|
||||
}
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
"updateNotifText": "Pembaruan baru tersedia! Versi terbaru: ",
|
||||
|
||||
"chineseCharacterAlert": "Jalur file yang diatur berisi karakter Cina, ini dapat menyebabkan masalah!",
|
||||
"foreignCharacterAlert": "Jalur file yang diatur berisi karakter Cina, ini dapat menyebabkan masalah!",
|
||||
|
||||
"dialogOk": "OK",
|
||||
"dialogNo": "TIDAK",
|
||||
|
@ -81,5 +81,5 @@
|
||||
|
||||
"updateNotifText": "新しいバージョンが利用できます。Version: ",
|
||||
|
||||
"chineseCharacterAlert": "ファイルパスに漢字やひらがななどの全角文字が含まれているため、正常に動作しない場合があります。"
|
||||
"foreignCharacterAlert": "ファイルパスに漢字やひらがななどの全角文字が含まれているため、正常に動作しない場合があります。"
|
||||
}
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
"updateNotifText": "Nowa wersja jest dostępna! Najnowsza wersja: ",
|
||||
|
||||
"chineseCharacterAlert": "Ścieżka pliku zawierająca chińskie symbole może powodować błędy.",
|
||||
"foreignCharacterAlert": "Ścieżka pliku zawierająca chińskie symbole może powodować błędy.",
|
||||
|
||||
"dialogOk": "Tak",
|
||||
"dialogNo": "Nie",
|
||||
|
@ -77,7 +77,7 @@
|
||||
|
||||
"updateNotifText": "Uma nova atualização esta disponivel! Nova versão: ",
|
||||
|
||||
"chineseCharacterAlert": "O caminho setado contem caracteres chineses, isso pode causar problemas!",
|
||||
"foreignCharacterAlert": "O caminho setado contem caracteres chineses, isso pode causar problemas!",
|
||||
|
||||
"dialogOk": "OK",
|
||||
"dialogNo": "Não",
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
"updateNotifText": "Phiên bản mới nhất đang khả dụng: ",
|
||||
|
||||
"chineseCharacterAlert": "Đường dẫn tới tệp tin chứa ký tự phức tạp, có thể gây lỗi!",
|
||||
"foreignCharacterAlert": "Đường dẫn tới tệp tin chứa ký tự phức tạp, có thể gây lỗi!",
|
||||
|
||||
"dialogOk": "OK",
|
||||
"dialogNo": "Không",
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
"updateNotifText": "有新的GrassClipper更新可用! 最新版本: ",
|
||||
|
||||
"chineseCharacterAlert": "此路徑含有中文字體,這可能會導致問題的發生。",
|
||||
"foreignCharacterAlert": "此路徑含有中文字體,這可能會導致問題的發生。",
|
||||
|
||||
"dialogOk": "好的",
|
||||
"dialogNo": "不要",
|
||||
|
@ -80,5 +80,5 @@
|
||||
|
||||
"updateNotifText": "有新版本可用!当前最新的版本是: ",
|
||||
|
||||
"chineseCharacterAlert": "当前文件路径含有中文字符,可能会导致一些问题。"
|
||||
"foreignCharacterAlert": "当前文件路径含有中文字符,可能会导致一些问题。"
|
||||
}
|
||||
|
@ -104,16 +104,11 @@ async function openGrasscutterFolder() {
|
||||
}
|
||||
|
||||
// https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html
|
||||
function hasChineseChars(str) {
|
||||
let re1 = new RegExp(/[\u4E00-\uFA29]/) //Chinese character range
|
||||
let re2 = new RegExp(/[\uE7C7-\uE7F3]/) //non Chinese character range
|
||||
function hasForeignChars(str) {
|
||||
let re1 = /^[\x00-\x7F]+$/g
|
||||
str = str.replace(/\s/g, '')
|
||||
|
||||
if (!re1.test(str) || re2.test(str)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return !re1.test(str)
|
||||
}
|
||||
|
||||
function openDialog(title, message, negBtn = false, affirmBtn = closeDialog) {
|
||||
|
@ -42,7 +42,7 @@ async function enableServerButton() {
|
||||
*/
|
||||
async function handleGameNotSet() {
|
||||
// Set buttons to greyed out and disable
|
||||
document.querySelector('#gamePath').innerHTML = localeObj.folderNotSet
|
||||
document.querySelector('#gamePath').innerHTML = localeObj.folderNotSet || 'Not set'
|
||||
|
||||
// Set official server background to default
|
||||
document.querySelector('#firstPanel').style.backgroundImage = 'url("../bg/private/default.png")'
|
||||
@ -61,7 +61,7 @@ async function handleGameNotSet() {
|
||||
|
||||
async function handleServerNotSet() {
|
||||
// Set buttons to greyed out and disable
|
||||
document.querySelector('#serverPath').innerHTML = localeObj.folderNotSet
|
||||
document.querySelector('#serverPath').innerHTML = localeObj.folderNotSet || 'Not set'
|
||||
|
||||
// Set official server background to default
|
||||
// document.querySelector('#firstPanel').style.backgroundImage = `url("../bg/private/default.png")`
|
||||
@ -223,7 +223,7 @@ async function handleFavoriteList() {
|
||||
document.createElement('li')
|
||||
)
|
||||
|
||||
listItem.innerHTML = localeObj.noFavorites
|
||||
listItem.innerHTML = localeObj.noFavorites || 'No favorites set'
|
||||
}
|
||||
|
||||
for (const ip of ipArr) {
|
||||
@ -404,14 +404,14 @@ async function displayServerLaunchSection() {
|
||||
* Set the game folder by opening a folder picker
|
||||
*/
|
||||
async function setGameExe() {
|
||||
const gameExe = await Neutralino.os.showOpenDialog(localeObj.gameFolderDialog, {
|
||||
const gameExe = await Neutralino.os.showOpenDialog(localeObj.gameFolderDialog || 'Select game folder', {
|
||||
filters: [
|
||||
{ name: 'Executable files', extensions: ['exe'] }
|
||||
]
|
||||
})
|
||||
|
||||
if (!gameExe[0]) return
|
||||
if (hasChineseChars(gameExe[0])) displayAlert(localeObj.chineseCharacterAlert)
|
||||
if (hasForeignChars(gameExe[0])) displayAlert(localeObj.foreignCharacterAlert || 'The file path set contains Chinese characters, this may cause problems!')
|
||||
|
||||
// Set the folder in our configuration
|
||||
const config = await getCfg()
|
||||
@ -435,7 +435,9 @@ async function setGrasscutterFolder() {
|
||||
})
|
||||
|
||||
if (!folder[0]) return
|
||||
if (hasChineseChars(folder[0])) displayAlert(localeObj.chineseCharacterAlert)
|
||||
|
||||
console.log(hasForeignChars(folder[0]))
|
||||
if (hasForeignChars(folder[0])) displayAlert(localeObj.foreignCharacterAlert)
|
||||
|
||||
// Set the folder in our configuration
|
||||
const config = await getCfg()
|
||||
|
Loading…
Reference in New Issue
Block a user