From 1051c0d50e814c0f95eaca94996601c687763932 Mon Sep 17 00:00:00 2001 From: Negue Date: Fri, 2 Jan 2015 02:22:22 +0100 Subject: [PATCH] maybe fixes the multilingual content result --- src/controllers/user.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/controllers/user.js b/src/controllers/user.js index b4505d95f8..bbcbef0982 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -22,15 +22,15 @@ var validator = require('validator'); // api.purchase // Shared.ops api.getContent = function(req, res, next) { - var language = req.query.language; //|| 'en' in i18n + var language = req.query.language.toString(); //|| 'en' in i18n var content = _.cloneDeep(shared.content); - var walk = function(obj){ + var walk = function(obj, lang){ _.each(obj, function(item, key, source){ - if(_.isPlainObject(item) || _.isArray(item)) return walk(item); - if(_.isFunction(item) && item.i18nLangFunc) source[key] = item(language); + if(_.isPlainObject(item) || _.isArray(item)) return walk(item, lang); + if(_.isFunction(item) && item.i18nLangFunc) source[key] = item(lang); }); } - walk(content); + walk(content, language); res.json(content); }