From 7d736f9352cf9e8f1ee0a0cd63b1b4495e724c8c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 9 Feb 2014 12:15:47 -0500 Subject: [PATCH] fixed hebrew language string and introducing fallback to english if wrong language is set --- public/language/he/language.json | 2 +- public/src/translator.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/public/language/he/language.json b/public/language/he/language.json index 8983d00350..f0b5f30d6d 100644 --- a/public/language/he/language.json +++ b/public/language/he/language.json @@ -1,4 +1,4 @@ { "name": "עברית (ישראל)", - "code": "he_IL" + "code": "he" } \ No newline at end of file diff --git a/public/src/translator.js b/public/src/translator.js index 2304f54259..d0747e100d 100644 --- a/public/src/translator.js +++ b/public/src/translator.js @@ -201,9 +201,15 @@ Meta = require('../../src/meta'), path = require('path'), fs = require('fs'), - winston = require('winston'); + winston = require('winston'), + language = Meta.config.defaultLang; - utils.walk(path.join(__dirname, '../language', (Meta.config.defaultLang || 'en_GB')), function (err, data) { + if (!fs.existsSync(path.join(__dirname, '../language', language))) { + winston.warn('[translator] Language \'' + Meta.config.defaultLang + '\' not found. Defaulting to \'en_GB\''); + language = 'en_GB'; + } + + utils.walk(path.join(__dirname, '../language', language), function (err, data) { var loaded = data.length; for (var d in data) {