From 3b3c383d93239aa7b14cf180d0232bb325ec6c63 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 17 Aug 2015 17:20:41 -0400 Subject: [PATCH] adding a fallback for en_GB and en_US --- public/src/modules/translator.js | 59 +++++++++++++++++--------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index 90784747c9..96ec0b513a 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -47,33 +47,38 @@ // Load the appropriate timeago locale file, and correct NodeBB language codes to timeago codes, if necessary var languageCode; switch(config.userLang) { - case 'cs': - languageCode = 'cz'; - break; - - case 'fa_IR': - languageCode = 'fa'; - break; - - case 'pt_BR': - languageCode = 'pt-br'; - break; - - case 'nb': - languageCode = 'no'; - break; - - case 'zh_TW': - languageCode = 'zh-TW'; - break; - - case 'zh_CN': - languageCode = 'zh-CN'; - break; - - default: - languageCode = config.userLang; - break; + case 'en_GB': + case 'en_US': + languageCode = 'en'; + break; + + case 'cs': + languageCode = 'cz'; + break; + + case 'fa_IR': + languageCode = 'fa'; + break; + + case 'pt_BR': + languageCode = 'pt-br'; + break; + + case 'nb': + languageCode = 'no'; + break; + + case 'zh_TW': + languageCode = 'zh-TW'; + break; + + case 'zh_CN': + languageCode = 'zh-CN'; + break; + + default: + languageCode = config.userLang; + break; } $.getScript(RELATIVE_PATH + '/vendor/jquery/timeago/locales/jquery.timeago.' + languageCode + '.js').success(function() {