middleware/mw.app.context.js
function setLanguage(req) {
        var host = req.info.host;

        // hack fix for m.reviews, m.fr, m.es, etc.
        if (host.substring(0, 2) === 'm.') {
            req.app.isLegacyMobile = true;
            host = host.substring(2);
        }

        var subdomain = host.substring(0, 2);

        // either at language-based subdomain or we use english
        req.app.lang = (host.charAt(2) === '.' && langSubdomains.indexOf(subdomain) >= 0) ?
            subdomain : 'en';
    }
function setLanguage(req) {
        var host = req.info.host;

        // hack fix for m.reviews, m.fr, m.es, etc.
        if (host.substring(0, 2) === 'm.') {
            req.app.isLegacyMobile = true;
            host = host.substring(2);
        }

        var subdomain = host.substring(0, 2);

        // either at language-based subdomain or we use english
        req.app.lang = (host.charAt(2) === '.' && langSubdomains.indexOf(subdomain) >= 0) ?
            subdomain : 'en';
    }
function setLanguage ( req ) { var host = req . info . host ; // hack fix for m.reviews, m.fr, m.es, etc. if ( host . substring ( 0 , 2 ) === 'm.' ) { req . app . isLegacyMobile = true ; host = host . substring ( 2 ) ; } var subdomain = host . substring ( 0 , 2 ) ; // either at language-based subdomain or we use english req . app . lang = ( host . charAt ( 2 ) === '.' && langSubdomains . indexOf ( subdomain ) >= 0 ) ? subdomain : 'en' ; }
Set the language depending on a couple different potential sources
@param req
Set the language depending on a couple different potential sources