Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
New POST handler for locale switcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
serter committed Feb 2, 2016
1 parent 2d5ff80 commit b9dbb76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.js
Expand Up @@ -168,6 +168,7 @@ function switch_locale(req) {
// var browser_lang = req.locale; // accept-language: fi;q=1
var path_lang = req.params.lang; // /fi/about
var get_lang = req.query.lang; // /about?lang=fi
var post_lang = req.body.lang; // POST lang=fi

//rlog(browser_lang, path_lang, get_lang);
// locale precedence:
Expand All @@ -180,6 +181,9 @@ function switch_locale(req) {
if(get_lang !== undefined) {
locale = get_lang;
}
if(post_lang !== undefined) {
locale = post_lang;
}

// set default application locale if request is hairy
if(!locale.match(/^(fi|en|sv)$/)) {
Expand Down

0 comments on commit b9dbb76

Please sign in to comment.