fix(mobile): export i18n for mobile so it can temporarily use en translations
This commit is contained in:
+12
-1
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user