Skip to content

Commit

Permalink
non ascii warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cubewhy committed Jan 30, 2024
1 parent 8e635aa commit cbcb194
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/kotlin/org/cubewhy/celestial/Celestial.kt
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ object Celestial {
}
log.info("Args was dumped to $launchScript")
log.info("Natives file: $natives")
// check non-ascii chars on Microsoft Windows
if (OSEnum.current == OSEnum.Windows && argsString.hasNonAscii()) {
JOptionPane.showMessageDialog(this.launcherFrame, f.getString("gui.non-ascii.warn"), "Warning", JOptionPane.WARNING_MESSAGE)
}
return natives // success
}

Expand Down Expand Up @@ -711,3 +715,13 @@ object Celestial {
}
}
}

private fun String.hasNonAscii(): Boolean {
// todo make it high performance
this.toCharArray().forEach {
if (it.code !in 0..127) {
return false
}
}
return true
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.cubewhy.celestial.gui.GuiLauncher
import org.cubewhy.celestial.utils.CrashReportType
import org.cubewhy.celestial.utils.FileUtils.unzipNatives
import org.cubewhy.celestial.utils.GuiUtils
import org.cubewhy.celestial.utils.OSEnum
import org.cubewhy.celestial.utils.SystemUtils.callExternalProcess
import org.cubewhy.celestial.utils.SystemUtils.findJava
import org.cubewhy.celestial.utils.TextUtils.dumpTrace
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/languages/launcher.properties
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,8 @@ Paste the link from the browser into Celestial and click OK\n\
Special thanks: ChatGPT, procbridge\n\
Disclaimer: Celestial is open source software. If your account is stolen, we have nothing to do with it. If you open the login window without clicking the login button,\n\
please ignore it!
gui.non-ascii.warn=Warning: Celestial's support for Windows is not very good, and your startup command contains non-ascii characters\n\
This may cause startup failure!\n\
\n\
*Celestial is cross-platform, why not try Linux?

4 changes: 4 additions & 0 deletions src/main/resources/languages/launcher_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,7 @@ Paste the link from the browser into Celestial and click OK\n\
Special thanks: ChatGPT, procbridge\n\
Disclaimer: Celestial is open source software. If your account is stolen, we have nothing to do with it. If you open the login window without clicking the login button,\n\
please ignore it!
gui.non-ascii.warn=Warning: Celestial's support for Windows is not very good, and your startup command contains non-ascii characters\n\
This may cause startup failure!\n\
\n\
*Celestial is cross-platform, why not try Linux?
4 changes: 4 additions & 0 deletions src/main/resources/languages/launcher_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,8 @@ Celestial はウィンドウをポップアップし、リンクを自動的に
特別な感謝: ChatGPT、procbridge\n\
免責事項: Celestial はオープン ソース ソフトウェアです。アカウントが盗まれた場合、当社はそれとは何の関係もありません。ログイン ボタンをクリックせずにログイン ウィンドウを開いた場合、\n\
無視してください!
gui.non-ascii.warn=警告: Celestial の Windows サポートはあまり良くなく、起動コマンドに非 ASCII 文字が含まれています\n\
これにより起動エラーが発生する可能性があります!\n\
\n\
*Celestial はクロスプラットフォームです。オープンソースで無料の Linux を試してみてはいかがでしょうか?

4 changes: 4 additions & 0 deletions src/main/resources/languages/launcher_ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,7 @@ Celestial이 팝업창을 띄우고 자동으로 링크를 복사합니다. 이
특별 감사: ChatGPT, procbridge\n\
면책 조항: Celestial은 오픈 소스 소프트웨어입니다. 귀하의 계정이 도난당하더라도 당사는 이와 관련이 없습니다. 로그인 버튼을 클릭하지 않고 로그인 창을 열면\n\
무시해주세요!
gui.non-ascii.warn=경고: Celestial의 Windows 지원은 그리 좋지 않으며 시작 명령에 ASCII가 아닌 문자가 포함되어 있습니다.\n\
이로 인해 시작 오류가 발생할 수 있습니다!\n\
\\N\
*Celestial은 크로스 플랫폼입니다. 오픈 소스와 무료 Linux를 사용해 보는 것은 어떨까요?
4 changes: 4 additions & 0 deletions src/main/resources/languages/launcher_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,8 @@ Celestial就会弹出一个窗口并自动复制链接, 这时候打开一个InP
特别鸣谢: ChatGPT, procbridge\n\
免责声明: Celestial是开源软件, 若你的账户被盗, 与我们无关, 如果你没有点击登录按钮却打开了登录窗口,\n\
请不要理会!
gui.non-ascii.warn=警告: Celestial对Windows的支持并不是很好,而你的启动指令中带有非ascii字符\n\
这可能导致启动失败!\n\
\n\
*Celestial是跨平台的, 为何不尝试一下开源免费的Linux呢

0 comments on commit cbcb194

Please sign in to comment.