We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69d79d0 commit 10e22f6Copy full SHA for 10e22f6
modules/translation/translation.go
@@ -27,8 +27,9 @@ type LangType struct {
27
}
28
29
var (
30
- matcher language.Matcher
31
- allLangs []LangType
+ matcher language.Matcher
+ allLangs []LangType
32
+ defaultLang string
33
)
34
35
// AllLangs returns all supported langauages
@@ -69,6 +70,7 @@ func InitLocales() {
69
70
71
72
73
+ defaultLang = setting.Langs[0]
74
i18n.SetDefaultLang(setting.Langs[0])
75
76
allLangs = make([]LangType, 0, i18n.Count()-1)
@@ -91,6 +93,9 @@ type locale struct {
91
93
92
94
// NewLocale return a locale
95
func NewLocale(lang string) Locale {
96
+ if len(lang) == 0 {
97
+ lang = defaultLang
98
+ }
99
return &locale{
100
Lang: lang,
101
0 commit comments