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

Safe Haskell | None

Happstack.Server.I18N

Synopsis

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

# Documentation

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

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

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

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.