diff --git a/middleware/changeLanguage.js b/middleware/changeLanguage.js index 9a69f6ce5..ea9b00b4b 100644 --- a/middleware/changeLanguage.js +++ b/middleware/changeLanguage.js @@ -66,7 +66,7 @@ function updateDocs( req, res, translations ){ res.data.forEach( function( doc, p ){ // update name.default to the request language (if available) - translateNameDefault(doc, requestLanguage); + translateNameDefault(doc, req.clean.lang.iso6391); // skip invalid records if( !doc || !doc.parent ){ return; } diff --git a/test/unit/middleware/changeLanguage.js b/test/unit/middleware/changeLanguage.js index beb2753bf..6d933cbaa 100644 --- a/test/unit/middleware/changeLanguage.js +++ b/test/unit/middleware/changeLanguage.js @@ -133,7 +133,8 @@ module.exports.tests.success_conditions = (test, common) => { const req = { clean: { lang: { - iso6393: 'requested language' + iso6393: 'requested language', + iso6391: 'requested language' } } };