Get the language that is used by the localizer by retrieving a well-known string that is required to be present
()
| 117 | |
| 118 | // Get the language that is used by the localizer by retrieving a well-known string that is required to be present |
| 119 | func (sl *SimpleLocalizer) GetLang() string { |
| 120 | _, tag, err := sl.Localizer.LocalizeWithTag(&i18n.LocalizeConfig{MessageID: "loading"}) |
| 121 | if err != nil { |
| 122 | return "en" |
| 123 | } |
| 124 | return tag.String() |
| 125 | } |
| 126 | |
| 127 | // GetLocalizer creates a localizer based on the request's Accept-Language header or forcedLanguage option |
| 128 | func GetLocalizer(r *http.Request) *SimpleLocalizer { |