aboutsummaryrefslogtreecommitdiffstats
path: root/modules/translation
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-06-02 17:27:30 +0800
committerGitHub <noreply@github.com>2023-06-02 17:27:30 +0800
commitde4a21fcb4476772c69c36d086549e89ed4dcf6c (patch)
treea8952b92bc6382daffc34178f5d6cc32cfea2efd /modules/translation
parent7a5873335afb00dda5fa123fb023c88278e79deb (diff)
downloadgitea-de4a21fcb4476772c69c36d086549e89ed4dcf6c.tar.gz
gitea-de4a21fcb4476772c69c36d086549e89ed4dcf6c.zip
Refactor INI package (first step) (#25024)
The INI package has many bugs and quirks, and in fact it is unmaintained. This PR is the first step for the INI package refactoring: * Use Gitea's "config_provider" to provide INI access * Deprecate the INI package by golangci.yml rule
Diffstat (limited to 'modules/translation')
-rw-r--r--modules/translation/i18n/localestore.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/modules/translation/i18n/localestore.go b/modules/translation/i18n/localestore.go
index 0664bcfd1a..aa784e866f 100644
--- a/modules/translation/i18n/localestore.go
+++ b/modules/translation/i18n/localestore.go
@@ -7,8 +7,7 @@ import (
"fmt"
"code.gitea.io/gitea/modules/log"
-
- "gopkg.in/ini.v1"
+ "code.gitea.io/gitea/modules/setting"
)
// This file implements the static LocaleStore that will not watch for changes
@@ -47,14 +46,10 @@ func (store *localeStore) AddLocaleByIni(langName, langDesc string, source, more
l := &locale{store: store, langName: langName, idxToMsgMap: make(map[int]string)}
store.localeMap[l.langName] = l
- iniFile, err := ini.LoadSources(ini.LoadOptions{
- IgnoreInlineComment: true,
- UnescapeValueCommentSymbols: true,
- }, source, moreSource)
+ iniFile, err := setting.NewConfigProviderForLocale(source, moreSource)
if err != nil {
return fmt.Errorf("unable to load ini: %w", err)
}
- iniFile.BlockMode = false
for _, section := range iniFile.Sections() {
for _, key := range section.Keys() {