commit2ed4e3e307Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit690157811bAuthor: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit046ff63e42Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commitfaf7f51d85Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
42 lines
901 B
Go
42 lines
901 B
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
// defaultI18nLangNames must be a slice, we need the order
|
|
var defaultI18nLangNames = []string{
|
|
"en-US", "English",
|
|
"zh-CN", "简体中文",
|
|
}
|
|
|
|
func defaultI18nLangs() (res []string) {
|
|
for i := 0; i < len(defaultI18nLangNames); i += 2 {
|
|
res = append(res, defaultI18nLangNames[i])
|
|
}
|
|
return res
|
|
}
|
|
|
|
func defaultI18nNames() (res []string) {
|
|
for i := 0; i < len(defaultI18nLangNames); i += 2 {
|
|
res = append(res, defaultI18nLangNames[i+1])
|
|
}
|
|
return res
|
|
}
|
|
|
|
var (
|
|
// I18n settings
|
|
Langs []string
|
|
Names []string
|
|
)
|
|
|
|
func loadI18nFrom(rootCfg ConfigProvider) {
|
|
Langs = rootCfg.Section("i18n").Key("LANGS").Strings(",")
|
|
if len(Langs) == 0 {
|
|
Langs = defaultI18nLangs()
|
|
}
|
|
Names = rootCfg.Section("i18n").Key("NAMES").Strings(",")
|
|
if len(Names) == 0 {
|
|
Names = defaultI18nNames()
|
|
}
|
|
}
|