Skip to content

Commit 10e22f6

Browse files
committed
make use of it
1 parent 69d79d0 commit 10e22f6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/translation/translation.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ type LangType struct {
2727
}
2828

2929
var (
30-
matcher language.Matcher
31-
allLangs []LangType
30+
matcher language.Matcher
31+
allLangs []LangType
32+
defaultLang string
3233
)
3334

3435
// AllLangs returns all supported langauages
@@ -69,6 +70,7 @@ func InitLocales() {
6970
}
7071
}
7172

73+
defaultLang = setting.Langs[0]
7274
i18n.SetDefaultLang(setting.Langs[0])
7375

7476
allLangs = make([]LangType, 0, i18n.Count()-1)
@@ -91,6 +93,9 @@ type locale struct {
9193

9294
// NewLocale return a locale
9395
func NewLocale(lang string) Locale {
96+
if len(lang) == 0 {
97+
lang = defaultLang
98+
}
9499
return &locale{
95100
Lang: lang,
96101
}

0 commit comments

Comments
 (0)