Skip to content

Commit

Permalink
fix: locales
Browse files Browse the repository at this point in the history
  • Loading branch information
fesiong committed Aug 17, 2024
1 parent a7db129 commit bd47a0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions provider/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,22 @@ func (w *Website) GetTimeFactorSetting() (setting config.PluginTimeFactor) {
// 这是一个兼容函数,请使用 ctx.Tr
func (w *Website) Tr(str string, args ...interface{}) string {
if I18n != nil {
return I18n.Tr(w.backLanguage, str, args...)
tmpStr := I18n.Tr(w.backLanguage, str, args...)
if tmpStr != "" {
return tmpStr
}
}

return fmt.Sprintf(str, args...)
}

func (w *Website) TplTr(str string, args ...interface{}) string {
if I18n != nil {
return I18n.Tr(w.System.Language, str, args...)
tmpStr := I18n.Tr(w.System.Language, str, args...)
if tmpStr != "" {
return tmpStr
}
}

return fmt.Sprintf(str, args...)
}

Expand Down

0 comments on commit bd47a0d

Please sign in to comment.