From 7202de6f4cd027e2f50fd68488d5c80bbc5c3a8a Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:43:15 +0800 Subject: [PATCH] feat: Add pt-BR support for i18n (#7261) --- backend/i18n/i18n.go | 6 +++++- cmd/server/cmd/root.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/i18n/i18n.go b/backend/i18n/i18n.go index cad6f7d92..c102e2fcd 100644 --- a/backend/i18n/i18n.go +++ b/backend/i18n/i18n.go @@ -99,11 +99,15 @@ func Init() { _, _ = 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") } func UseI18nForCmd(lang string) { if lang == "" { - lang = "zh" + lang = "en" + } + if lang == "pt-BR" { + lang = "pt" } if bundle == nil { Init() diff --git a/cmd/server/cmd/root.go b/cmd/server/cmd/root.go index 4fe640874..34be4020c 100644 --- a/cmd/server/cmd/root.go +++ b/cmd/server/cmd/root.go @@ -16,7 +16,7 @@ import ( var language string func init() { - RootCmd.PersistentFlags().StringVarP(&language, "language", "l", "zh", "Set the language (default is 'zh')") + RootCmd.PersistentFlags().StringVarP(&language, "language", "l", "en", "Set the language") } var RootCmd = &cobra.Command{