Convert coffee files to JS
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
require('coffee-script');
|
||||
var t = require('./translation.js');
|
||||
|
||||
var NUMBER_OF_QUESTIONS = 12;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
require('coffee-script');
|
||||
var i18n = require('../i18n.coffee');
|
||||
var i18n = require('../i18n');
|
||||
|
||||
var t = function(string, vars) {
|
||||
var func = function(lang) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
require('coffee-script');
|
||||
var _ = require('lodash');
|
||||
var content = require('./content/index.coffee');
|
||||
var content = require('./content/index');
|
||||
|
||||
var DROP_ANIMALS = _.keys(content.pets);
|
||||
|
||||
|
||||
@@ -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
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user