happstack-server-7.9.3: Web related tools and services.

Safe Haskell | None
Language | Haskell2010

Happstack.Server.I18N

Synopsis

- acceptLanguage :: Happstack m => m [(Text, Maybe Double)]
- bestLanguage :: [(Text, Maybe Double)] -> [Text]

# Documentation

acceptLanguage :: Happstack m => m [(Text, Maybe Double)] Source #

parse the 'Accept-Language' header, or [] if not found.

bestLanguage :: [(Text, Maybe Double)] -> [Text] Source #

deconstruct the `acceptLanguage` results a return a list of languages sorted by preference in descending order.

Note: this implementation does not conform to RFC4647

Among other things, it does not handle wildcards. A proper implementation needs to take a list of available languages.