Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/app/service/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@
_ = appDetailRepo.DeleteByAppIds(context.Background(), deleteIDS)
}

func (a AppService) SyncAppListFromRemote(taskID string) (err error) {

Check failure on line 905 in agent/app/service/app.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 166 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZrh6kqCvXclxoqwIZQx&open=AZrh6kqCvXclxoqwIZQx&pullRequest=11164
if xpack.IsUseCustomApp() {
return nil
}
Expand Down Expand Up @@ -1153,7 +1153,7 @@
}, nil)

go func() {
if err = syncTask.Execute(); err != nil {
if err := syncTask.Execute(); err != nil {

Check warning on line 1156 in agent/app/service/app.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary variable declaration and use the expression directly in the condition.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZrh6kqCvXclxoqwIZQy&open=AZrh6kqCvXclxoqwIZQy&pullRequest=11164
_ = NewISettingService().Update("AppStoreLastModified", "0")
_ = NewISettingService().Update("AppStoreSyncStatus", constant.StatusError)
}
Expand Down
36 changes: 24 additions & 12 deletions agent/i18n/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
"gopkg.in/yaml.v3"
)

var langFiles = map[string]string{
"zh": "lang/zh.yaml",
"en": "lang/en.yaml",
"zh-Hant": "lang/zh-Hant.yaml",
"pt-BR": "lang/pt-BR.yaml",
"ja": "lang/ja.yaml",
"ru": "lang/ru.yaml",
"ms": "lang/ms.yaml",
"ko": "lang/ko.yaml",
"tr": "lang/tr.yaml",
"es-ES": "lang/es-ES.yaml",
}

func GetMsgWithMap(key string, maps map[string]interface{}) string {
var content string
if maps == nil {
Expand Down Expand Up @@ -123,18 +136,17 @@
func Init() {
bundle = i18n.NewBundle(language.Chinese)
bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)
_, _ = bundle.LoadMessageFileFS(fs, "lang/zh.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/en.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/zh-Hant.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/fa.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/pt.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/pt-BR.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ja.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ru.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ms.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/ko.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/tr.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/es-ES.yaml")
isSuccess := true
for _, file := range langFiles {
if _, err := bundle.LoadMessageFileFS(fs, file); err != nil {
global.LOG.Errorf("[i18n] load language file %s failed: %v\n", file, err)
isSuccess = false
}
}

if !isSuccess {
panic("[i18n] failed to init language files, See log above for details")

Check failure on line 148 in agent/i18n/i18n.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Return an error instead of using panic for normal error conditions.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZrh6kvXvXclxoqwIZQz&open=AZrh6kvXvXclxoqwIZQz&pullRequest=11164
}
lang := GetLanguageFromDB()
global.I18n = i18n.NewLocalizer(bundle, lang)
}
Expand Down
2 changes: 1 addition & 1 deletion agent/i18n/lang/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ IgnoreUploadErr: "Upload failed, error: {{ .detail }}, ignoring this error..."
LoadBackupFailed: "Failed to get backup account connection, error: {{ .detail }}"
InExecuting: "The current task is being executed, please do not repeat the execution!"
NoSuchResource: "No backup content found in the database, skipping..."
CleanLog: "Clean Log",
CleanLog: "Clean Log"
CleanLogByName: "Clean {{.name}} Log"

#toolbox
Expand Down
6 changes: 3 additions & 3 deletions agent/i18n/lang/tr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ ExportDate: "Zaman"

#file
ErrFileCanNotRead: 'Bu dosya önizlemeyi desteklemiyor'
ErrFileToLarge: 'Dosya 10M'dan büyük ve açılamıyor'
ErrFileToLarge: 'Dosya 10M dan büyük ve açılamıyor'
ErrPathNotFound: 'Dizin mevcut değil'
ErrMovePathFailed: 'Hedef yol orijinal yolu içeremez!'
ErrLinkPathNotFound: 'Hedef yol mevcut değil!'
ErrFileIsExist: 'Dosya veya klasör zaten mevcut!'
ErrFileUpload: '{{ .name }} dosya yükleme başarısız {{ .detail }}'
ErrFileDownloadDir: 'Klasör indirme desteklenmiyor'
ErrCmdNotFound: '{{ .name}} komutu mevcut değil, lütfen önce bu komutu host'a yükleyin'
ErrCmdNotFound: '{{ .name}} komutu mevcut değil, lütfen önce bu komutu host a yükleyin'
ErrSourcePathNotFound: 'Kaynak dizin mevcut değil'
ErrFavoriteExist: 'Bu yol zaten favorilere eklendi'
ErrInvalidChar: 'Yasak karakterlere izin verilmiyor'
Expand Down Expand Up @@ -408,7 +408,7 @@ SnapNewDB: 'Veritabanı {{ .name }} bağlantısını başlat'
SnapDeleteOperationLog: 'İşlem günlüğünü sil'
SnapDeleteLoginLog: 'Erişim günlüğünü sil'
SnapDeleteMonitor: 'İzleme verilerini sil'
SnapRemoveSystemIP: 'Sistem IP'sini kaldır'
SnapRemoveSystemIP: 'Sistem IP sini kaldır'
SnapBaseInfo: '1Panel temel bilgilerini yaz'
SnapInstallAppImageEmpty: 'Uygulama imageı seçilmedi, atlanıyor...'
SnapInstallApp: '1Panel yüklü uygulamaları yedekle'
Expand Down
Loading