Skip to content

Commit

Permalink
feat: 更多语言支持(机器翻译)
Browse files Browse the repository at this point in the history
  • Loading branch information
UlinoyaPed committed Aug 29, 2023
1 parent afcae30 commit 8df200e
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 18 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# RepoTemplate
# QuickClash

12 changes: 11 additions & 1 deletion config/QuickClash.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
quickclash:
#语言 en zh-CN
#Language:
#"ara": "العربية"
#"de": "Deutsch"
#"en": "English"
#"fra": "français"
#"jp": "日本語"
#"kor": "한국어"
#"ru": "русский"
#"th": "ภาษาไทย"
#"zh-CN": "简体中文"
#"zh-TW": "繁體中文"
lang: zh-CN
#sublink可留空,但需要在程序运行时手动输入
sublink:
Expand Down
15 changes: 15 additions & 0 deletions lang/ara.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = تم إلغاء إعدادات البروكسي بنجاح!
cancelProxyFail = فشل في إلغاء إعدادات البروكسي: %s
configFile = ملف التكوين
downloading = جاري تحميل %s، يرجى الانتظار
dlComplete = تم تنزيل الملف بنجاح!
unziping = جاري فك الضغط عن الملفات
inputSublink = لم تقم بملء حقل quickclash.sublink، يرجى إدخاله هنا
noneedUpdateC = لا حاجة لتحديث ملف التكوين
currentCore = النواة الحالية: %s
coreSetWrong = إعدادات النواة غير صحيحة، يرجى التحقق من %s
clashOpening = جاري فتح Clash
setProxySuccess = تم ضبط خادم البروكسي بنجاح: %s!
setProxyFail = فشل في ضبط خادم البروكسي: %s، خطأ: %s
baseUrl = عنوان URL الأساسي لوحة الإدارة: http://%s السر: %s
webUIStarted = تم بدء لوحة الإدارة، يرجى زيارة localhost%s
15 changes: 15 additions & 0 deletions lang/de.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = Proxy-Einstellungen erfolgreich abgebrochen!
cancelProxyFail = Proxy-Einstellungen konnten nicht abgebrochen werden: %s
configFile = Konfigurationsdatei
downloading = Lade %s herunter, bitte warten Sie
dlComplete = Dateidownload abgeschlossen!
unziping = Entpacke Dateien
inputSublink = Sie haben das Feld quickclash.sublink nicht ausgefüllt. Bitte geben Sie es hier ein.
noneedUpdateC = Keine Aktualisierung der Konfigurationsdatei erforderlich
currentCore = Derzeitiger Kern: %s
coreSetWrong = Falsche Kern-Einstellungen. Bitte überprüfen Sie %s
clashOpening = Öffne Clash
setProxySuccess = Proxy-Server erfolgreich eingestellt: %s!
setProxyFail = Fehler beim Einstellen des Proxy-Servers: %s, Fehler: %s
baseUrl = Basis-URL des Administrationspanels: http://%s Geheimnis: %s
webUIStarted = Administrationspanel wurde gestartet. Bitte besuchen Sie localhost%s
28 changes: 14 additions & 14 deletions lang/en.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
cancelProxySuccess = Cancel proxy succeeded!
cancelProxyFail = Cancel proxy failed: %s.
configFile = config file
downloading = Downloading %s, please wait.
cancelProxySuccess = Proxy settings cancelled successfully!
cancelProxyFail = Failed to cancel proxy settings: %s
configFile = Configuration file
downloading = Downloading %s, please wait
dlComplete = File download completed!
unziping = Unziping file.
inputSublink = You did not fill in `quickclash.sublink` field, please input your sublink here.
noneedUpdateC = The configuration file does not need to be updated.
currentCore = Currently is %s core.
coreSetWrong = Incorrect kernel settings, please check %s!
clashOpening = Opening Clash.
setProxySuccess = Setting proxy server: %s succeeded!
setProxyFail = Setting proxy server: %s failed: %s.
baseUrl = Base url of Management Panel: http://%s Secret%s
webUIStarted = The management panel has started, please visit localhost%s
unziping = Extracting files
inputSublink = You haven't filled in the quickclash.sublink field, please enter it here
noneedUpdateC = No need to update the configuration file
currentCore = Currently using %s core
coreSetWrong = Incorrect core settings, please check %s
clashOpening = Opening Clash
setProxySuccess = Proxy server set successfully: %s!
setProxyFail = Failed to set proxy server: %s, Error: %s
baseUrl = Admin panel Base URL: http://%s Secret: %s
webUIStarted = Admin panel has been started, please visit localhost%s
15 changes: 15 additions & 0 deletions lang/fra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = Annulation des paramètres du proxy réussie !
cancelProxyFail = Échec de l'annulation des paramètres du proxy : %s
configFile = Fichier de configuration
downloading = Téléchargement de %s en cours, veuillez patienter
dlComplete = Téléchargement du fichier terminé !
unziping = Extraction des fichiers en cours
inputSublink = Vous n'avez pas rempli le champ quickclash.sublink, veuillez le saisir ici
noneedUpdateC = Aucune mise à jour du fichier de configuration nécessaire
currentCore = Noyau actuel : %s
coreSetWrong = Paramètres de noyau incorrects, veuillez vérifier %s
clashOpening = Ouverture de Clash
setProxySuccess = Serveur proxy configuré avec succès : %s !
setProxyFail = Échec de la configuration du serveur proxy : %s, Erreur : %s
baseUrl = URL de base du panneau d'administration : http://%s Secret : %s
webUIStarted = Le panneau d'administration a été démarré, veuillez visiter localhost%s
15 changes: 15 additions & 0 deletions lang/jp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = プロキシ設定が正常にキャンセルされました!
cancelProxyFail = プロキシ設定のキャンセルに失敗しました: %s
configFile = 設定ファイル
downloading = %s をダウンロード中です、お待ちください
dlComplete = ファイルのダウンロードが完了しました!
unziping = ファイルの解凍中です
inputSublink = quickclash.sublink フィールドが入力されていません。こちらに入力してください
noneedUpdateC = 設定ファイルは更新の必要がありません
currentCore = 現在のコアは %s です
coreSetWrong = コアの設定が正しくありません。 %s を確認してください
clashOpening = Clash を起動中です
setProxySuccess = プロキシサーバーが正常に設定されました:%s!
setProxyFail = プロキシサーバーの設定に失敗しました:%s、エラー:%s
baseUrl = 管理パネルのベースURL:http://%s シークレット:%s
webUIStarted = 管理パネルが起動されました。localhost%s をご覧ください
15 changes: 15 additions & 0 deletions lang/kor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = 프록시 설정이 성공적으로 취소되었습니다!
cancelProxyFail = 프록시 설정 취소 실패: %s
configFile = 설정 파일
downloading = %s 다운로드 중, 잠시 기다려주세요
dlComplete = 파일 다운로드 완료!
unziping = 파일 압축 해제 중
inputSublink = quickclash.sublink 필드를 작성하지 않으셨습니다. 여기에 입력해주세요.
noneedUpdateC = 설정 파일 업데이트 필요 없음
currentCore = 현재 %s 코어를 사용 중입니다
coreSetWrong = 잘못된 코어 설정입니다. %s 확인해주세요
clashOpening = Clash 실행 중
setProxySuccess = 프록시 서버 설정 성공: %s!
setProxyFail = 프록시 서버 설정 실패: %s, 오류: %s
baseUrl = 관리 패널 기본 URL: http://%s 비밀번호: %s
webUIStarted = 관리 패널이 시작되었습니다. localhost%s 방문해주세요
15 changes: 15 additions & 0 deletions lang/ru.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = Прокси-настройки успешно отменены!
cancelProxyFail = Ошибка отмены настроек прокси: %s
configFile = Файл конфигурации
downloading = Загрузка %s, пожалуйста, подождите
dlComplete = Загрузка файла завершена!
unziping = Извлечение файлов
inputSublink = Вы не заполнили поле quickclash.sublink, пожалуйста, введите его здесь
noneedUpdateC = Нет необходимости обновлять файл конфигурации
currentCore = Текущее ядро: %s
coreSetWrong = Неверные настройки ядра, пожалуйста, проверьте %s
clashOpening = Открытие Clash
setProxySuccess = Прокси-сервер успешно настроен: %s!
setProxyFail = Ошибка настройки прокси-сервера: %s, Ошибка: %s
baseUrl = Базовый URL панели администратора: http://%s Секрет: %s
webUIStarted = Панель администратора запущена, пожалуйста, посетите localhost%s
15 changes: 15 additions & 0 deletions lang/th.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = ยกเลิกการตั้งค่าพร็อกซีเรียบร้อยแล้ว!
cancelProxyFail = ไม่สามารถยกเลิกการตั้งค่าพร็อกซีได้: %s
configFile = ไฟล์การตั้งค่า
downloading = กำลังดาวน์โหลด %s โปรดรอสักครู่
dlComplete = ดาวน์โหลดไฟล์เสร็จสมบูรณ์แล้ว!
unziping = กำลังแตกไฟล์
inputSublink = คุณไม่ได้กรอกฟิลด์ quickclash.sublink กรุณากรอกที่นี่
noneedUpdateC = ไม่จำเป็นต้องอัปเดตไฟล์การตั้งค่า
currentCore = ใช้คอร์ %s ปัจจุบัน
coreSetWrong = การตั้งค่าคอร์ไม่ถูกต้อง โปรดตรวจสอบ %s
clashOpening = กำลังเปิด Clash
setProxySuccess = ตั้งค่าเซิร์ฟเวอร์พร็อกซีเรียบร้อย: %s!
setProxyFail = ตั้งค่าเซิร์ฟเวอร์พร็อกซีล้มเหลว: %s, ข้อผิดพลาด: %s
baseUrl = URL พื้นฐานของแผงการจัดการ: http://%s รหัสลับ: %s
webUIStarted = แผงการจัดการเริ่มทำงานแล้ว โปรดเข้าชมที่ localhost%s
15 changes: 15 additions & 0 deletions lang/zh-TW.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cancelProxySuccess = 成功取消代理設置!
cancelProxyFail = 取消代理設置失敗:%s
configFile = 配置檔案
downloading = 正在下載%s,請稍等
dlComplete = 檔案下載完成!
unziping = 正在解壓縮檔案
inputSublink = 您沒有填寫 quickclash.sublink 欄位,請在此處輸入
noneedUpdateC = 配置檔案無需更新
currentCore = 目前為 %s 核心
coreSetWrong = 核心設置有誤,請檢查 %s
clashOpening = 正在開啟 Clash
setProxySuccess = 設置代理伺服器成功:%s!
setProxyFail = 設置代理伺服器失敗:%s,錯誤:%s
baseUrl = 管理面板 Base URL:http://%s Secret:%s
webUIStarted = 管理面板已啟動,請訪問 localhost%s
19 changes: 17 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,30 @@ func init() {
//多语言
DefaultLang := config.String("quickclash.lang")
Languages := map[string]string{
"ara": "العربية",
"de": "Deutsch",
"en": "English",
"fra": "français",
"jp": "日本語",
"kor": "한국어",
"ru": "русский",
"th": "ภาษาไทย",
"zh-CN": "简体中文",
"zh-TW": "繁體中文",
}
i18n.Init("lang/", DefaultLang, Languages)

}

func cancelProxy() {
//取消代理
if err := SetProxy(""); err == nil {
color.BgLightBlue.Println(i18n.Dtr("cancelProxySuccess"))
} else {
color.BgRed.Println(i18n.Dtr("cancelProxyFail", err))
}
//等待2秒,防止按下关闭后看不清取消代理的状态
time.Sleep(2 * time.Second)
}

func main() {
Expand Down Expand Up @@ -151,9 +162,10 @@ func main() {
//等待2秒
time.Sleep(2 * time.Second)

//关闭时自动取消代理
defer cancelProxy()
//设置系统代理
proxy := fmt.Sprintf("127.0.0.1:%s", config.String("port"))
defer cancelProxy()
if err := SetProxy(proxy); err == nil {
color.BgLightBlue.Println(i18n.Dtr("setProxySuccess", proxy))
} else {
Expand All @@ -165,7 +177,10 @@ func main() {
color.BgLightRed.Println(i18n.Dtr("webUIStarted", GinPort))

// 阻止主协程退出,以保持Gin服务的运行
//select {}
Clog()
}

func Clog() {
c := make(chan os.Signal)
signal.Notify(c)
s := <-c
Expand Down

0 comments on commit 8df200e

Please sign in to comment.