If there is more than one url query parameter that sets the language (req.query.lang for example) the request.language.toLowerCase is not a function error is thrown.
The error is thrown in:
// a query parameter overwrites all
if (queryParameter && request.url) {
var urlObj = url.parse(request.url, true);
if (urlObj.query[queryParameter]) {
logDebug('Overriding locale from query: ' + urlObj.query[queryParameter]);
request.language = urlObj.query[queryParameter];
if (preserveLegacyCase) {
request.language = request.language.toLowerCase();
}
return i18n.setLocale(request, request.language);
}
}
at the request.language = request.language.toLowerCase(); line. One solution would be to check if the query param is an array and always take the last element but I would like to hear opinions on it.
Hello,
If there is more than one url query parameter that sets the language (
req.query.lang
for example) therequest.language.toLowerCase is not a function
error is thrown. The error is thrown in:at the
request.language = request.language.toLowerCase();
line. One solution would be to check if the query param is an array and always take the last element but I would like to hear opinions on it.