# all files / keystone/lib/middleware/ language.js

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    211×
    1×

    1×
    7×

    7×

     var requestLanguage = require('express-request-language');
    var assign = require('object-assign');

    module.exports = function (keystone) {
    	var languageOptions = assign({
    		'supported languages': ['en-US'],
    		'language cookie': 'language',
    		'language cookie options': {},
    		'language select url': '/languages/{language}',
    	}, keystone.get('language options'));

    	return requestLanguage({
    		languages: languageOptions['supported languages'],
    		cookie: {
    			name: languageOptions['language cookie'],
    			url: languageOptions['language select url'],
    		},
    		queryName: languageOptions['language query name'],
    	});
    };