phoenix_locale v0.0.2 PhoenixLocale

module that provides helpers to localise Phoenix applications

Summary

Functions

get the default locale

get application’s I18n module

check if given locale exists

get the prefered locale based on the input locale, session and accept-language request header

match the prefered locale based on the accept_language http request header, and the existing I18n locales return nil if none

return if exists an already set location in the session

Functions

default_locale(conn)

get the default locale

i18n(conn)

get application’s I18n module

params_locale(conn)

check if given locale exists

prefered_locale(conn)

get the prefered locale based on the input locale, session and accept-language request header

return nil if there’s none and :wrong if the params_locale doesn’t exist

req_header_locale(conn)

match the prefered locale based on the accept_language http request header, and the existing I18n locales return nil if none

session_locale(conn)

return if exists an already set location in the session