fix: Update language files and improve error handling in i18n module

This commit is contained in:
HynoR 2025-11-21 12:55:07 +08:00
parent b057a4b1bd
commit bf43790042
9 changed files with 47 additions and 43 deletions

View file

@ -23,12 +23,10 @@ var langFiles = map[string]string{
"zh": "lang/zh.yaml",
"en": "lang/en.yaml",
"zh-Hant": "lang/zh-Hant.yaml",
"fa": "lang/fa.yaml",
"pt": "lang/pt.yaml",
"pt-BR": "lang/pt-BR.yaml",
"ja": "lang/ja.yaml",
"ru": "lang/ru.yaml",
"ms": "lang/ms.yaml",
"ms": "lang/ms.yml",
"ko": "lang/ko.yaml",
"tr": "lang/tr.yaml",
"es-ES": "lang/es-ES.yaml",
@ -142,12 +140,18 @@ func Init() {
bundle = i18n.NewBundle(language.Chinese)
bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)
isSuccess := true
for _, file := range langFiles {
if _, err := bundle.LoadMessageFileFS(fs, file); err != nil {
fmt.Printf("failed to load language file %s: %v\n", file, err)
isSuccess = false
}
}
if !isSuccess {
panic("failed to load language files, See log above for details")
}
dbLang := getLanguageFromDBInternal()
SetCachedDBLanguage(dbLang)
if dbLang == "" {

View file

@ -37,11 +37,11 @@ MasterNode: "Master Node"
# app
CustomAppStoreFileValid: "Application store package requires .tar.gz format"
ErrFileNotFound: "{{ .name }} file does not exist"
AppBackup: 'Application backup',
AppBackupPush: 'Transfer application backup file {{.file}} to node {{ .name }}',
ErrSourceTargetSame: 'Source node and target node cannot be the same!',
AppInstall: 'Install application {{ .name }} on node {{ .targetNode }}',
AppInstallCheck: 'Check application installation environment',
AppBackup: 'Application backup'
AppBackupPush: 'Transfer application backup file {{.file}} to node {{ .name }}'
ErrSourceTargetSame: 'Source node and target node cannot be the same!'
AppInstall: 'Install application {{ .name }} on node {{ .targetNode }}'
AppInstallCheck: 'Check application installation environment'
# backup
ErrBackupInUsed: "This backup account is used in scheduled tasks and cannot be deleted"

View file

@ -37,11 +37,11 @@ MasterNode: "Nodo Maestro"
# app
CustomAppStoreFileValid: "El paquete de la tienda de aplicaciones debe tener formato .tar.gz"
ErrFileNotFound: "El archivo {{ .name }} no existe"
AppBackup: 'Copia de seguridad de aplicación',
AppBackupPush: 'Transferir archivo de copia de seguridad de aplicación {{.file}} al nodo {{ .name }}',
ErrSourceTargetSame: '¡El nodo de origen y el nodo de destino no pueden ser el mismo!',
AppInstall: 'Instalar aplicación {{ .name }} en nodo {{ .targetNode }}',
AppInstallCheck: 'Verificar entorno de instalación de aplicación',
AppBackup: 'Copia de seguridad de aplicación'
AppBackupPush: 'Transferir archivo de copia de seguridad de aplicación {{.file}} al nodo {{ .name }}'
ErrSourceTargetSame: '¡El nodo de origen y el nodo de destino no pueden ser el mismo!'
AppInstall: 'Instalar aplicación {{ .name }} en nodo {{ .targetNode }}'
AppInstallCheck: 'Verificar entorno de instalación de aplicación'
# backup
ErrBackupInUsed: "Esta cuenta de respaldo se utiliza en tareas programadas y no se puede eliminar"

View file

@ -37,11 +37,11 @@ MasterNode: "マスターノード"
# app
CustomAppStoreFileValid: "アプリストアパッケージは .tar.gz 形式である必要があります"
ErrFileNotFound: "{{ .name }} ファイルが存在しません"
AppBackup: 'アプリケーションバックアップ',
AppBackupPush: 'アプリケーションバックアップファイル {{.file}} をノード {{ .name }} に転送',
ErrSourceTargetSame: 'ソースノードとターゲットノードは同じにできません!',
AppInstall: 'ノード {{ .targetNode }} にアプリケーション {{ .name }} をインストール',
AppInstallCheck: 'アプリケーションインストール環境を確認',
AppBackup: 'アプリケーションバックアップ'
AppBackupPush: 'アプリケーションバックアップファイル {{.file}} をノード {{ .name }} に転送'
ErrSourceTargetSame: 'ソースノードとターゲットノードは同じにできません!'
AppInstall: 'ノード {{ .targetNode }} にアプリケーション {{ .name }} をインストール'
AppInstallCheck: 'アプリケーションインストール環境を確認'
# backup
ErrBackupInUsed: "このバックアップアカウントはスケジュールタスクで使用されており、削除できません"

View file

@ -37,11 +37,11 @@ MasterNode: "마스터 노드"
# app
CustomAppStoreFileValid: "앱 스토어 패키지는 .tar.gz 형식이어야 합니다"
ErrFileNotFound: "{{ .name }} 파일이 존재하지 않습니다"
AppBackup: '애플리케이션 백업',
AppBackupPush: '애플리케이션 백업 파일 {{.file}}을(를) 노드 {{ .name }}(으)로 전송',
ErrSourceTargetSame: '소스 노드와 대상 노드는 동일할 수 없습니다!',
AppInstall: '노드 {{ .targetNode }}에 애플리케이션 {{ .name }} 설치',
AppInstallCheck: '애플리케이션 설치 환경 확인',
AppBackup: '애플리케이션 백업'
AppBackupPush: '애플리케이션 백업 파일 {{.file}}을(를) 노드 {{ .name }}(으)로 전송'
ErrSourceTargetSame: '소스 노드와 대상 노드는 동일할 수 없습니다!'
AppInstall: '노드 {{ .targetNode }}에 애플리케이션 {{ .name }} 설치'
AppInstallCheck: '애플리케이션 설치 환경 확인'
# backup
ErrBackupInUsed: "이 백업 계정은 예약된 작업에 사용 중이며 삭제할 수 없습니다"

View file

@ -37,11 +37,11 @@ MasterNode: "Nó Mestre"
# app
CustomAppStoreFileValid: "O pacote da loja de aplicativos deve estar no formato .tar.gz"
ErrFileNotFound: "Arquivo {{ .name }} não encontrado"
AppBackup: 'Backup de aplicação',
AppBackupPush: 'Transferir arquivo de backup de aplicação {{.file}} para o nó {{ .name }}',
ErrSourceTargetSame: 'O nó de origem e o nó de destino não podem ser os mesmos!',
AppInstall: 'Instalar aplicação {{ .name }} no nó {{ .targetNode }}',
AppInstallCheck: 'Verificar ambiente de instalação da aplicação',
AppBackup: 'Backup de aplicação'
AppBackupPush: 'Transferir arquivo de backup de aplicação {{.file}} para o nó {{ .name }}'
ErrSourceTargetSame: 'O nó de origem e o nó de destino não podem ser os mesmos!'
AppInstall: 'Instalar aplicação {{ .name }} no nó {{ .targetNode }}'
AppInstallCheck: 'Verificar ambiente de instalação da aplicação'
# backup
ErrBackupInUsed: "Esta conta de backup está em uso em tarefas agendadas e não pode ser excluída"

View file

@ -37,11 +37,11 @@ MasterNode: "Главный узел"
# app
CustomAppStoreFileValid: "Пакет магазина приложений должен быть в формате .tar.gz"
ErrFileNotFound: "Файл {{ .name }} не найден"
AppBackup: 'Резервная копия приложения',
AppBackupPush: 'Передать файл резервной копии приложения {{.file}} на узел {{ .name }}',
ErrSourceTargetSame: 'Исходный узел и целевой узел не могут быть одинаковыми!',
AppInstall: 'Установить приложение {{ .name }} на узел {{ .targetNode }}',
AppInstallCheck: 'Проверить среду установки приложения',
AppBackup: 'Резервная копия приложения'
AppBackupPush: 'Передать файл резервной копии приложения {{.file}} на узел {{ .name }}'
ErrSourceTargetSame: 'Исходный узел и целевой узел не могут быть одинаковыми!'
AppInstall: 'Установить приложение {{ .name }} на узел {{ .targetNode }}'
AppInstallCheck: 'Проверить среду установки приложения'
# backup
ErrBackupInUsed: "Эта учетная запись резервного копирования используется в запланированных задачах и не может быть удалена"

View file

@ -37,11 +37,11 @@ MasterNode: "Ana Düğüm"
# app
CustomAppStoreFileValid: "Uygulama mağazası paketi .tar.gz formatında olmalıdır"
ErrFileNotFound: "{{ .name }} dosyası mevcut değil"
AppBackup: 'Uygulama yedekleme',
AppBackupPush: 'Uygulama yedek dosyası {{.file}} düğüm {{ .name }} a aktar',
ErrSourceTargetSame: 'Kaynak düğüm ve hedef düğüm aynı olamaz!',
AppInstall: 'Düğüm {{ .targetNode }} üzerine {{ .name }} uygulamasını yükle',
AppInstallCheck: 'Uygulama kurulum ortamını kontrol et',
AppBackup: 'Uygulama yedekleme'
AppBackupPush: 'Uygulama yedek dosyası {{.file}} düğüm {{ .name }} a aktar'
ErrSourceTargetSame: 'Kaynak düğüm ve hedef düğüm aynı olamaz!'
AppInstall: 'Düğüm {{ .targetNode }} üzerine {{ .name }} uygulamasını yükle'
AppInstallCheck: 'Uygulama kurulum ortamını kontrol et'
# backup
ErrBackupInUsed: "Bu yedekleme hesabı zamanlanmış görevlerde kullanılıyor ve silinemez"

View file

@ -37,11 +37,11 @@ MasterNode: "主節點"
#app
CustomAppStoreFileValid: "應用商店包需要 .tar.gz 格式"
ErrFileNotFound: "{{ .name }} 檔案不存在"
AppBackup: '應用備份',
AppBackupPush: '傳輸應用備份文件 {{.file}} 到節點 {{ .name }}',
ErrSourceTargetSame: '源節點和目標節點不能相同!',
AppInstall: '在 {{ .targetNode }} 節點安裝應用 {{ .name }}',
AppInstallCheck: '檢查應用安裝環境',
AppBackup: '應用備份'
AppBackupPush: '傳輸應用備份文件 {{.file}} 到節點 {{ .name }}'
ErrSourceTargetSame: '源節點和目標節點不能相同!'
AppInstall: '在 {{ .targetNode }} 節點安裝應用 {{ .name }}'
AppInstallCheck: '檢查應用安裝環境'
#backup
ErrBackupInUsed: "該備份帳號已在排程任務中使用,無法刪除"