Changed most of the English output strings to formatted strings.

This commit is contained in:
Luke Slater 2012-05-19 17:36:21 +01:00
parent fa2d0b8465
commit 059768592a
4 changed files with 49 additions and 30 deletions

View File

@ -24,7 +24,7 @@ var autoshorten = function(dbot) {
http.get(options, function(res) {
res.setEncoding('utf8');
res.on('data', function (response) {
dbot.say(data.channel, 'Shortened link from ' + data.user + ': ' + JSON.parse(response).surl);
dbot.say(data.channel, dbot.t('shorten_link', {'user': data.user}) + JSON.parse(response).surl);
});
});
}

View File

@ -14,14 +14,9 @@ var command = function(dbot) {
}
}
var usageString = 'Usage: ~ignore [module]. Modules you can ignore are: ';
for(var i=0;i<ignorableModules.length;i++) {
usageString += ignorableModules[i] + ", ";
}
usageString = usageString.slice(0, -2) + '.';
if(params[1] == undefined) {
dbot.say(data.channel, data.user + ': ' + usageString);
dbot.say(data.channel,
dbot.t('ignore_usage', {'user': data.user, 'modules': ignorableModules.join(', ')}));
} else {
if(dbot.moduleNames.include(params[1])) {
if(!dbot.db.ignores.hasOwnProperty(data.user)) {
@ -29,14 +24,13 @@ var command = function(dbot) {
}
if(dbot.db.ignores[data.user].include(params[1])) {
dbot.say(data.channel, data.user + ': You\'re already ignoring that module.');
dbot.say(data.channel, dbot.t('already_ignoring', {'user': data.user}));
} else {
dbot.db.ignores[data.user].push(params[1]);
dbot.say(data.channel, data.user + ': Now ignoring ' + params[1]);
dbot.say(data.channel, dbot.t('ignored', {'user': data.user, 'module': params[1]}));
}
} else {
dbot.say(data.channel, data.user + ': That isn\'t a valid module name. ' +
usageString);
dbot.say(data.channel, dbot.t('invalid_ignore', {'user': data.user}));
}
}
},
@ -47,25 +41,15 @@ var command = function(dbot) {
ignoredModules = dbot.db.ignores[data.user];
}
var usageString = 'Usage: ~unignore [module]. Modules you are currently ignoring: ';
if(ignoredModules.length == 0) {
usageString += 'None.';
} else {
for(var i=0;i<ignoredModules.length;i++) {
usageString += ignoredModules[i] + ", ";
}
usageString = usageString.slice(0, -2) + '.';
}
if(params[1] == undefined) {
dbot.say(data.channel, data.user + ': ' + usageString);
dbot.say(data.channel,
dbot.t('unignore_usage', {'user': data.user, 'modules': ignoredModules.join(', ')}));
} else {
if(ignoredModules.include(params[1]) == false) {
dbot.say(data.channel, data.user +
': You\'re not ignoring that module or it doesn\'t exist. ' + usageString);
dbot.say(data.channel, dbot.t('invalid_unignore', {'user': data.user}));
} else {
dbot.db.ignores[data.user].splice(dbot.db.ignores[data.user].indexOf(params[1]), 1);
dbot.say(data.channel, data.user + ': No longer ignoring ' + params[1]);
dbot.say(data.channel, dbot.t('unignored', {'user': data.user, 'module': params[1]}));
}
}
}
@ -121,7 +105,7 @@ var command = function(dbot) {
}
if(winnerDistance < 3) {
dbot.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!');
dbot.say(data.channel, dbot.t('command_typo', {'command': winner}));
}
}
}

View File

@ -17,7 +17,7 @@ var kick = function(dbot) {
var kicked = dbot.db.kickers[params[1]];
}
dbot.say(data.channel, params[1] + ' has been kicked ' + kicks + ' times and has kicked people ' + kicked + ' times.');
dbot.say(data.channel, dbot.t('user_kicks', {'user': params[1], 'kicks': kicks, 'kicked': kicked}));
},
// Output a list of the people who have been kicked the most and those
@ -52,7 +52,7 @@ var kick = function(dbot) {
'listener': function(data) {
if(data.kickee == dbot.name) {
dbot.instance.join(data.channel);
dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name);
dbot.say(data.channel, dbot.t('kicked_dbot', {'botname': dbot.name}));
dbot.db.kicks[dbot.name] += 1;
} else {
@ -78,7 +78,9 @@ var kick = function(dbot) {
dbot.db.kickers[data.user] += 1;
}
dbot.say(data.channel, data.kickee + '-- (' + data.kickee + ' has been kicked ' + dbot.db.kicks[data.kickee] + ' times)');
dbot.say(data.channel, data.kickee + '-- (' +
dbot.t('user_kicks', {'user': data.kickee, 'kicks': dbot.db.kicks[data.kickee],
'kicked': dbot.db.kickers[data.kickee]}) + ')');
}
},

View File

@ -140,5 +140,38 @@
},
"quote_link": {
"english": "Link to {category}"
},
"shorten_link": {
"english": "Shortened link from {user}: "
},
"ignore_usage": {
"english": "{user}: Usage: ~ignore [module]. Modules you can ignore are: {modules}."
},
"already_ignoring": {
"english": "{user}: You're already ignoring that module."
},
"ignored": {
"english": "{user}: Now ignoring {module}."
},
"invalid_ignore": {
"english": "{user}: That isn't a valid module name."
},
"unignore_usage": {
"english": "{user}: Usage: ~unignore [module]. Modules you are currently ignoring: {modules}."
},
"invalid_unignore": {
"english": "{user}: You're not ignoring that module or it doesn't exist."
},
"unignored": {
"english": "{user}: No longer ignoring {module}."
},
"command_typo": {
"english": "Did you mean '{command}'? Learn to type."
},
"user_kicks": {
"english": "{user} has been kicked {kicks} times and has kicked people {kicked} times."
},
"kicked_dbot": {
"english": "Thou shalt not kick {botname}"
}
}