fix(mobile): export i18n for mobile so it can temporarily use en translations

This commit is contained in:
Tyler Renelle 2014-05-08 13:56:01 -06:00
parent 628ea0accd
commit 3edd37f537
2 changed files with 12 additions and 8 deletions

View file

@ -94,4 +94,15 @@ module.exports = {
langCodes: langCodes,
getUserLanguage: getUserLanguage,
momentLangs: momentLangs
};
};
// Export en strings only, temporary solution for mobile
// This is copied from middleware.js#module.exports.locals#t()
module.exports.enTranslations = function(){ // stringName and vars are the allowed parameters
var language = _.find(avalaibleLanguages, {code: 'en'});
//language.momentLang = ((!isStaticPage && i18n.momentLangs[language.code]) || undefined);
var args = Array.prototype.slice.call(arguments, 0);
args.push(language.code);
return shared.i18n.t.apply(null, args);
};

View file

@ -170,10 +170,3 @@ module.exports.locals = function(req, res, next) {
next();
}
module.exports.enTranslations = function(stringName, vars){
var language = {code:'en'};
var string = translations[language.code][stringName];
if(!string) return _.template(translations[language.code].stringNotFound, {string: stringName});
return vars === undefined ? string : _.template(string, vars);
};