Fix the missing i18n key for update checker (#18646)
This commit is contained in:
parent
f393bc82cb
commit
c2a3e38194
3 changed files with 20 additions and 0 deletions
|
@ -39,6 +39,18 @@ func AllLangs() []LangType {
|
|||
return allLangs
|
||||
}
|
||||
|
||||
// TryTr tries to do the translation, if no translation, it returns (format, false)
|
||||
func TryTr(lang, format string, args ...interface{}) (string, bool) {
|
||||
s := i18n.Tr(lang, format, args...)
|
||||
// now the i18n library is not good enough and we can only use this hacky method to detect whether the transaction exists
|
||||
idx := strings.IndexByte(format, '.')
|
||||
defaultText := format
|
||||
if idx > 0 {
|
||||
defaultText = format[idx+1:]
|
||||
}
|
||||
return s, s != defaultText
|
||||
}
|
||||
|
||||
// InitLocales loads the locales
|
||||
func InitLocales() {
|
||||
i18n.Reset()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue