From 479b176362aa62afa84df2e9b059e33e5aad453b Mon Sep 17 00:00:00 2001 From: Mihnea Dobrescu-Balaur Date: Fri, 24 May 2019 17:01:56 +0300 Subject: [PATCH] ES needs 2 letter lang code. --- middleware/changeLanguage.js | 2 +- test/unit/middleware/changeLanguage.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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' } } };