Skip to content

Commit 6d014ce

Browse files
committed
update documents about LANGS
1 parent ca565ab commit 6d014ce

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ PATH =
21172117
;[i18n]
21182118
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21192119
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2120+
;; The first locale will be used as the default if user browser's language doesn't match any locale in the list.
21202121
;LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN
21212122
;NAMES = English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം
21222123

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ Default templates for project boards:
997997

998998
## i18n (`i18n`)
999999

1000-
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**: List of locales shown in language selector
1000+
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
1001+
List of locales shown in language selector. The first locale will be used as the default if user browser's language doesn't match any locale in the list.
10011002
- `NAMES`: **English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം**: Visible names corresponding to the locales
10021003

10031004
## U2F (`U2F`) **DEPRECATED**

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ LANGS = en-US,foo-BAR
299299
NAMES = English,FooBar
300300
```
301301

302+
The first locale will be used as the default if user browser's language doesn't match any locale in the list.
303+
302304
Locales may change between versions, so keeping track of your customized locales is highly encouraged.
303305

304306
### Readmes

modules/translation/translation.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ func InitLocales() {
8181
}
8282
}
8383
if len(setting.Langs) != 0 {
84-
log.Info("Use the first language (%s) in LANGS setting option as default language", setting.Langs[0])
85-
i18n.DefaultLocales.SetDefaultLang(setting.Langs[0])
84+
defaultLangName := setting.Langs[0]
85+
if defaultLangName != "en-US" {
86+
log.Info("Use the first locale (%s) in LANGS setting option as default", defaultLangName)
87+
}
88+
i18n.DefaultLocales.SetDefaultLang(defaultLangName)
8689
}
8790

8891
langs, descs := i18n.DefaultLocales.ListLangNameDesc()

0 commit comments

Comments
 (0)