forked from GitHub/dbot
refactored DBot.prototype.t to error properly
This commit is contained in:
parent
23c20f0937
commit
6e727ed9d8
9
run.js
9
run.js
@ -86,16 +86,17 @@ DBot.prototype.say = function(server, channel, message) {
|
|||||||
|
|
||||||
// Format given stored string in config language
|
// Format given stored string in config language
|
||||||
DBot.prototype.t = function(string, formatData) {
|
DBot.prototype.t = function(string, formatData) {
|
||||||
var formattedString;
|
var formattedString = 'String not found. Something has gone screwy. Maybe.';
|
||||||
|
|
||||||
if(_.has(this.strings, string)) {
|
if(_.has(this.strings, string)) {
|
||||||
var lang = this.config.language;
|
var lang = this.config.language;
|
||||||
if(!_.has(this.strings[string], lang)) {
|
if(!_.has(this.strings[string], lang)) {
|
||||||
lang = "en";
|
lang = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
formattedString = this.strings[string][lang].format(formatData);
|
if(_.has(this.strings[string], lang)) {
|
||||||
} else {
|
formattedString = this.strings[string][lang].format(formatData);
|
||||||
formattedString = 'String not found. Something has gone screwy. Maybe.';
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return formattedString;
|
return formattedString;
|
||||||
|
Loading…
Reference in New Issue
Block a user