mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-21 13:24:16 +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,
|
||||
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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue