- Bump requirements
- Thanks @dirkholzapfel and @angelikatyborska for adding a whitelist option and fixing a failure when given an invalid locale
- Thanks @mtarnovan and @angelikatyborska for fixing an issue when a cookie used a language that was not supported
- Thanks @mtarnovan for fixing a compilation warning
- Thanks @mtarnovan and @ohrite for relaxing the gettext and phoenix dependencies
- Thanks @narnach for making the locale stick and using the http referer header.
- bumped deps
- Thanks @dirkholzapfel for bugfixing an accept-language header like "zh-Hans-CN;q=0.5"
- Thanks @dirkholzapfel for adding fallback to "nl" if "nl-nl" is given in accept header
- reformatted code here and there
- bumped dependency versions
bumped dependency versions
bumped dependency versions
Now also taking into account cookie settings for locale as suggested and initially written by @dirkholzapfel (Thank you!). The current precedence and fallback chain is now :
- locale in url (i.e. /nl-nl/)
- cookie
- request headers accept-language
- default locale from config
This update contains a deprecation waring for the Plug config the new config is now :
plug SetLocale, gettext: MyApp.Gettext, default_locale: "en-gb", cookie_key: "locale")
The cookie key is optional, dont forget if you want to use this feature that you application actually stores the preferred locale on the cookie with the same key :)
Including a bigfix by @dirkholzapfel which implement correct handling for URLs without given locale, Thanks !
Support fallback of base language, for example a requested /en-gb/ can fallback to /en/
Root paths not redirect to /en-gb in stead of /en-gb/
- Initial commit