From 604ba7f4bc298aa87db588563a4407ef8dfb8768 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 8 Mar 2017 09:58:39 +0000 Subject: [PATCH] Allow nodes to have translations not in core (#1183) * Allow nodes to have translations not in core Currently only languages in the core are checked when the editor requests a translation. This means that if a node includes more translations they are not checked. This change removes the check against that short list, but it only checks the first language from the browser suported list * remove whitespace --- red/api/locales.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/red/api/locales.js b/red/api/locales.js index ece50f25a..eb28094b1 100644 --- a/red/api/locales.js +++ b/red/api/locales.js @@ -16,30 +16,12 @@ var fs = require('fs'); var path = require('path'); var i18n; -var supportedLangs = []; - -var apiLocalDir = path.resolve(path.join(__dirname,"locales")); - -var initSupportedLangs = function() { - fs.readdir(apiLocalDir, function(err,files) { - if(!err) { - supportedLangs = files; - } - }); -} function determineLangFromHeaders(acceptedLanguages){ var lang = i18n.defaultLang; acceptedLanguages = acceptedLanguages || []; - for (var i=0;i= 1) { + lang = acceptedLanguages[0]; } return lang; } @@ -47,7 +29,6 @@ function determineLangFromHeaders(acceptedLanguages){ module.exports = { init: function(runtime) { i18n = runtime.i18n; - initSupportedLangs(); }, get: function(req,res) { var namespace = req.params[0];