diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-03-30 14:58:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 14:58:33 +0800 |
commit | 71afbcafa9f8200af3f2e4848fad605116159c7f (patch) | |
tree | 767bdee9aad4f1e93a2ff061efd43a668fa12bd9 /build | |
parent | 74225033413dc0f2b308bbe069f6d185b551e364 (diff) | |
download | gitea-71afbcafa9f8200af3f2e4848fad605116159c7f.tar.gz gitea-71afbcafa9f8200af3f2e4848fad605116159c7f.zip |
Improve backport-locales.go (#23807)
ps: there are more broken translation strings in 1.20 (main), most of
them are still caused by incorrect quoting/unquoting. For example,
translators might write text ``` `my text ```, such incorrect encoding
might break crowdin & Gitea's locale package.
In the future, a Go `update-locales.go` should replace the legacy
`update-locales.sh`.
Diffstat (limited to 'build')
-rw-r--r-- | build/backport-locales.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/build/backport-locales.go b/build/backport-locales.go index 9421b6925e..a717b37367 100644 --- a/build/backport-locales.go +++ b/build/backport-locales.go @@ -77,10 +77,11 @@ func main() { if secNew.HasKey(keyEnUs.Name()) { oldStr := secOld.Key(keyEnUs.Name()).String() newStr := secNew.Key(keyEnUs.Name()).String() - // A bug: many of new translations with ";" are broken in Crowdin (due to last messy restoring) - // As the broken strings are gradually fixed, this workaround check could be removed (in a few months?) - if strings.Contains(oldStr, ";") && !strings.Contains(newStr, ";") { - println("skip potential broken string", path, secEnUS.Name(), keyEnUs.Name()) + if oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%") { + fmt.Printf("WARNING: locale %s [%s]%s has different number of arguments, skipping\n", path, secEnUS.Name(), keyEnUs.Name()) + fmt.Printf("\told: %s\n", oldStr) + fmt.Printf("\tnew: %s\n", newStr) + fmt.Println("---- ") continue } secOld.Key(keyEnUs.Name()).SetValue(newStr) |