添加多语言支持以及英语翻译

This commit is contained in:
cxykevin 2024-05-03 11:42:02 +08:00
parent 669ab5c7b7
commit eac7311e45
2 changed files with 27 additions and 1 deletions

21
lang/en_us.toml Normal file
View File

@ -0,0 +1,21 @@
UnsupportedSystem = "Current operating system is not supported."
PermissionDeniedLinux = "On linux operating systems, install with root privileges."
PermissionDeniedWin = "Permission Denied."
InstallWelcome = "Welcome to install PEInjector"
InstallInfo = "PEinjector is a tool and platform for enhancing WindowsPE."
DownloadInstallTitle = "Download files"
DownloadInstall = "Before we start, we need to download some dependencies\nIf your internet connection is poor, please download 'peinjector' and 'ventoy manually'\nand unzip them to the 'software' folder"
StartInstall = "Install Now"
InstallVtoy = "Install Ventoy"
InstallVtoyTitle = "Install Ventoy"
InstallVtoyInfo = "Please complete the installation manually in the open installer.\nIf the installation is complete, please click the \"Scan\" button and select your installed USB flash drive.\nIf you can't find your USB flash drive, please try to click \"Show all devices\".\nIf you can't open it or software that uses the arm architecture, run the following program manually:\n Windows: software\\ventoy\\altexe\\__your_program__.exe\n Linux: software/ventoy/altexe/__your_program__\nNote: Please make sure the disk is mounted."
ScanVtoy = "Scan"
RestartVtoy = "Restart installer"
ChooseVtoyDevice = "Select a device"
ShowAllDevices = "Show all devices"
InstallIjTitle = "Install PEinjector"
InstallIjInfo = "PEinjector is being installed, please wait..."
FinishInstall = "Completing"
InstallFinishTitle = "Installation is complete"
InstallFinishInfo = "PEinjector has been installed on your device\nClick the button below to close the program and restart to manage PEinjector."
InstallFinishBtn = "Close"

View File

@ -9,10 +9,15 @@ import sys
import getpass import getpass
import platform import platform
import ctypes import ctypes
import os
import locale
init() init()
load_lang("zh_cn") # TODO:读取设置 nlang = locale.getdefaultlocale()[0].lower()
if (nlang+".toml" not in os.listdir("lang")):
nlang = "en_us"
load_lang(nlang)
disk_res = get_disk.find_hub_disk() disk_res = get_disk.find_hub_disk()
errno = disk_res[0] errno = disk_res[0]