feat: Add pt-BR support for i18n (#7261)

pull/7263/head
ssongliu 2024-12-05 14:43:15 +08:00 committed by GitHub
parent e6a772ebfd
commit 7202de6f4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -99,11 +99,15 @@ func Init() {
_, _ = bundle.LoadMessageFileFS(fs, "lang/en.yaml") _, _ = bundle.LoadMessageFileFS(fs, "lang/en.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/zh-Hant.yaml") _, _ = bundle.LoadMessageFileFS(fs, "lang/zh-Hant.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/fa.yaml") _, _ = bundle.LoadMessageFileFS(fs, "lang/fa.yaml")
_, _ = bundle.LoadMessageFileFS(fs, "lang/pt.yaml")
} }
func UseI18nForCmd(lang string) { func UseI18nForCmd(lang string) {
if lang == "" { if lang == "" {
lang = "zh" lang = "en"
}
if lang == "pt-BR" {
lang = "pt"
} }
if bundle == nil { if bundle == nil {
Init() Init()

View File

@ -16,7 +16,7 @@ import (
var language string var language string
func init() { 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{ var RootCmd = &cobra.Command{