diff --git a/pkg/locale/locale.go b/pkg/locale/locale.go index ee460f4..76f0352 100644 --- a/pkg/locale/locale.go +++ b/pkg/locale/locale.go @@ -68,12 +68,14 @@ func Match(acceptLanguage string, locales Locales, matcher language.Matcher) *Lo return nil } var locale *Locale - tag, _, _ := matcher.Match(t...) - var ok bool - locale, ok = locales[tag] - for !ok && !tag.IsRoot() { - tag = tag.Parent() + tag, _, confidence := matcher.Match(t...) + if confidence > language.No { + var ok bool locale, ok = locales[tag] + for !ok && !tag.IsRoot() { + tag = tag.Parent() + locale, ok = locales[tag] + } } return locale }