Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultLocale = "en"
Variables ¶
SupportedLocales defines all locales that the application supports
Functions ¶
func Normalize ¶
Normalize ensures a locale string is in a standard BCP 47 format. It parses, canonicalizes, and matches against supported locales. If the locale is not supported, returns the closest match or default.
func ParseAcceptLanguage ¶
ParseAcceptLanguage parses the Accept-Language header and returns the most preferred supported locale as a BCP 47 language tag string (e.g., "en", "en-US", "pl", "de-DE"). It uses golang.org/x/text/language for proper RFC 4647 parsing and matching. If the user's desired language is not supported, it finds the closest match. If no suitable match is found, it returns the default locale "en".
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.