1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-21 17:08:27 +00:00

Use en-US as fallback when using other default language (#21200) (#21256)

Only en-US has complete translations. When use other language as
default, the en-US should still be used as fallback.

Backport #21200, Close #21199
This commit is contained in:
wxiaoguang
2022-09-25 22:14:57 +08:00
committed by GitHub
parent be5411d6b5
commit e79a10793f
3 changed files with 34 additions and 8 deletions

View File

@@ -41,14 +41,14 @@ func NewLocaleStore() *LocaleStore {
}
// AddLocaleByIni adds locale by ini into the store
func (ls *LocaleStore) AddLocaleByIni(langName, langDesc string, localeFile interface{}, otherLocaleFiles ...interface{}) error {
func (ls *LocaleStore) AddLocaleByIni(langName, langDesc string, source, moreSource []byte) error {
if _, ok := ls.localeMap[langName]; ok {
return ErrLocaleAlreadyExist
}
iniFile, err := ini.LoadSources(ini.LoadOptions{
IgnoreInlineComment: true,
UnescapeValueCommentSymbols: true,
}, localeFile, otherLocaleFiles...)
}, source, moreSource)
if err == nil {
iniFile.BlockMode = false
lc := &locale{store: ls, langName: langName, langDesc: langDesc, messages: iniFile}