move set default language url from hardcoded string to its own js var
remove duplicate code
fix 403 error flash message
convert per-session language switching to use the API endpoint