mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Convert coffee files to JS
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
module.exports = require('./script/index.coffee');
|
module.exports = require('./script/index');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('coffee-script');
|
|
||||||
var t = require('./translation.js');
|
var t = require('./translation.js');
|
||||||
|
|
||||||
var NUMBER_OF_QUESTIONS = 12;
|
var NUMBER_OF_QUESTIONS = 12;
|
||||||
|
|||||||
7005
common/script/content/index.js
Normal file
7005
common/script/content/index.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('coffee-script');
|
var i18n = require('../i18n');
|
||||||
var i18n = require('../i18n.coffee');
|
|
||||||
|
|
||||||
var t = function(string, vars) {
|
var t = function(string, vars) {
|
||||||
var func = function(lang) {
|
var func = function(lang) {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('coffee-script');
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var content = require('./content/index.coffee');
|
var content = require('./content/index');
|
||||||
|
|
||||||
var DROP_ANIMALS = _.keys(content.pets);
|
var DROP_ANIMALS = _.keys(content.pets);
|
||||||
|
|
||||||
|
|||||||
51
common/script/i18n.js
Normal file
51
common/script/i18n.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
var _;
|
||||||
|
|
||||||
|
_ = require('lodash');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
strings: null,
|
||||||
|
translations: {},
|
||||||
|
t: function(stringName) {
|
||||||
|
var clonedVars, e, locale, string, stringNotFound, vars;
|
||||||
|
vars = arguments[1];
|
||||||
|
if (_.isString(arguments[1])) {
|
||||||
|
vars = null;
|
||||||
|
locale = arguments[1];
|
||||||
|
} else if (arguments[2] != null) {
|
||||||
|
vars = arguments[1];
|
||||||
|
locale = arguments[2];
|
||||||
|
}
|
||||||
|
if ((locale == null) || (!module.exports.strings && !module.exports.translations[locale])) {
|
||||||
|
locale = 'en';
|
||||||
|
}
|
||||||
|
if (module.exports.strings) {
|
||||||
|
string = module.exports.strings[stringName];
|
||||||
|
} else {
|
||||||
|
string = module.exports.translations[locale] && module.exports.translations[locale][stringName];
|
||||||
|
}
|
||||||
|
clonedVars = _.clone(vars) || {};
|
||||||
|
clonedVars.locale = locale;
|
||||||
|
if (string) {
|
||||||
|
try {
|
||||||
|
return _.template(string, clonedVars);
|
||||||
|
} catch (_error) {
|
||||||
|
e = _error;
|
||||||
|
return 'Error processing the string. Please see Help > Report a Bug.';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (module.exports.strings) {
|
||||||
|
stringNotFound = module.exports.strings.stringNotFound;
|
||||||
|
} else if (module.exports.translations[locale]) {
|
||||||
|
stringNotFound = module.exports.translations[locale] && module.exports.translations[locale].stringNotFound;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return _.template(stringNotFound, {
|
||||||
|
string: stringName
|
||||||
|
});
|
||||||
|
} catch (_error) {
|
||||||
|
e = _error;
|
||||||
|
return 'Error processing the string. Please see Help > Report a Bug.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
File diff suppressed because it is too large
Load Diff
2864
common/script/index.js
Normal file
2864
common/script/index.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user