diff --git a/src/plugins.js b/src/plugins.js index 1045bab8c6..da7f25eefe 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -91,6 +91,16 @@ var middleware; // }); async.waterfall([ + function(next) { + // Build language code list + fs.readdir(path.join(__dirname, '../public/language'), function(err, directories) { + Plugins.languageCodes = directories.filter(function(code) { + return code !== 'TODO'; + }); + + next(); + }); + }, function(next) { db.getSortedSetRange('plugins:active', 0, -1, next); }, diff --git a/src/plugins/load.js b/src/plugins/load.js index 58dc244fbd..3b9a454e90 100644 --- a/src/plugins/load.js +++ b/src/plugins/load.js @@ -238,6 +238,16 @@ module.exports = function(Plugins) { _.extendOwn(Plugins.customLanguages[route], data); if (pluginData.defaultLang && pathToLang.endsWith(pluginData.defaultLang + '/' + path.basename(pathToLang))) { + console.log(Plugins.languageCodes); + Plugins.languageCodes.map(function(code) { + if (pluginData.defaultLang !== code) { + return code + '/' + path.basename(pathToLang); + } else { + return null; + } + }).filter(Boolean).forEach(function(key) { + Plugins.customLanguages[key] = _.defaults(Plugins.customLanguages[key] || {}, data); + }); fallbackMap[path.basename(pathToLang, '.json')] = path.join(pathToFolder, pluginData.defaultLang, path.basename(pathToLang)); }