mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
fix(mobile): export i18n for mobile so it can temporarily use en translations
This commit is contained in:
parent
628ea0accd
commit
3edd37f537
2 changed files with 12 additions and 8 deletions
13
src/i18n.js
13
src/i18n.js
|
|
@ -94,4 +94,15 @@ module.exports = {
|
||||||
langCodes: langCodes,
|
langCodes: langCodes,
|
||||||
getUserLanguage: getUserLanguage,
|
getUserLanguage: getUserLanguage,
|
||||||
momentLangs: momentLangs
|
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();
|
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);
|
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue