From fa2d0b8465ffca5fc1470ebdc9a37786367d50d7 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 19 May 2012 16:48:01 +0100 Subject: [PATCH] Converted all of the other modules to the new translate syntax. --- modules/admin.js | 22 +++++++++++----------- modules/command.js | 6 ++---- modules/spelling.js | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/modules/admin.js b/modules/admin.js index 7c5962f..36e3c1e 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -25,7 +25,7 @@ var adminCommands = function(dbot) { child = exec("git pull", function (error, stdout, stderr) { console.log(stderr); - dbot.say(data.channel, dbot.strings[dbot.language].gpull); + dbot.say(data.channel, dbot.t('gpull')); commands.reload(data, params); }.bind(this)); }, @@ -34,7 +34,7 @@ var adminCommands = function(dbot) { dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8')); dbot.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8')); dbot.reloadModules(); - dbot.say(data.channel, dbot.strings[dbot.language].reload); + dbot.say(data.channel, dbot.t('reload')); }, 'say': function(data, params) { @@ -60,7 +60,7 @@ var adminCommands = function(dbot) { 'load': function(data, params) { dbot.moduleNames.push(params[1]); dbot.reloadModules(); - dbot.say(data.channel, dbot.strings[dbot.language].load_module.format({'moduleName': params[1]})); + dbot.say(data.channel, dbot.t('load_module', {'moduleName': params[1]})); }, 'unload': function(data, params) { @@ -72,9 +72,9 @@ var adminCommands = function(dbot) { dbot.moduleNames.splice(moduleIndex, 1); dbot.reloadModules(); - dbot.say(data.channel, dbot.strings[dbot.language].unload_module.format({'moduleName': params[1]})); + dbot.say(data.channel, dbot.t('unload_module', {'moduleName': params[1]})); } else { - dbot.say(data.channel, dbot.strings[dbot.language].unload_error.format({'moduleName': params[1]})); + dbot.say(data.channel, dbot.t('unload_error', {'moduleName': params[1]})); } }, @@ -84,31 +84,31 @@ var adminCommands = function(dbot) { } else { dbot.db.bans[params[2]] = [ params[1] ]; } - dbot.say(data.channel, dbot.strings[dbot.language].banned.format({'user': params[1], 'command': params[2]})); + dbot.say(data.channel, dbot.t('banned', {'user': params[1], 'command': params[2]})); }, 'unban': function(data, params) { if(dbot.db.bans.hasOwnProperty(params[2]) && dbot.db.bans[params[2]].include(params[1])) { dbot.db.bans[params[2]].splice(dbot.db.bans[params[2]].indexOf(params[1]), 1); - dbot.say(data.channel, dbot.strings[dbot.language].unbanned.format({'user': params[1], 'command': params[2]})); + dbot.say(data.channel, dbot.t('unbanned', {'user': params[1], 'command': params[2]})); } else { - dbot.say(data.channel, dbot.strings[dbot.language].unban_error.format({'user': params[1]})); + dbot.say(data.channel, dbot.t('unban_error', {'user': params[1]})); } }, 'modehate': function(data, params) { dbot.db.modehate.push(params[1]); - dbot.say(data.channel, dbot.strings[dbot.language].modehate.format({'user': params[1]})); + dbot.say(data.channel, dbot.t('modehate', {'user': params[1]})); }, 'unmodehate': function(data, params) { dbot.db.modehate.splice(dbot.db.modehate.indexOf(params[1]), 1); - dbot.say(data.channel, dbot.strings[dbot.language].unmodehate.format({'user': params[1]})); + dbot.say(data.channel, dbot.t('unmodehate', {'user': params[1]})); }, 'lock': function(data, params) { dbot.db.locks.push(params[1]); - dbot.say(data.channel, dbot.strings[dbot.language].qlock.format({'category': params[1]})); + dbot.say(data.channel, dbot.t('qlock', {'category': params[1]})); } }; diff --git a/modules/command.js b/modules/command.js index a97eed2..b23f25a 100644 --- a/modules/command.js +++ b/modules/command.js @@ -79,8 +79,7 @@ var command = function(dbot) { if(dbot.commands.hasOwnProperty(params[0])) { if((dbot.db.bans.hasOwnProperty(params[0]) && dbot.db.bans[params[0]].include(data.user)) || dbot.db.bans['*'].include(data.user)) { - dbot.say(data.channel, data.user + - ' is banned from using this command. Commence incineration.'); + dbot.say(data.channel, dbot.t('command_ban', {'user': data.user})); } else { var commandBelongsTo = dbot.commandMap[params[0]]; if(dbot.db.ignores.hasOwnProperty(data.user) && @@ -95,8 +94,7 @@ var command = function(dbot) { var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2); if(q) { if(dbot.db.bans['*'].include(data.user)) { - dbot.say(data.channel, data.user + - ' is banned from using this command. Commence incineration.'); + dbot.say(data.channel, dbot.t('command_ban', {'user': data.user})); } else { q[1] = q[1].trim(); key = dbot.cleanNick(q[1]) diff --git a/modules/spelling.js b/modules/spelling.js index 8fed950..37f3d51 100644 --- a/modules/spelling.js +++ b/modules/spelling.js @@ -45,11 +45,11 @@ var spelling = function(dbot) { var otherQ = data.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4); if(q) { correct(data, q[1] || q[2], data.user, function (e) { - dbot.say(data.channel, dbot.strings[dbot.language].spelling_self.format(e)); + dbot.say(data.channel, dbot.t('spelling_self', e)); }); } else if(otherQ) { correct(data, otherQ[2] || otherQ[3], otherQ[1], function (e) { - dbot.say(data.channel, dbot.strings[dbot.language].spelling_other.format(e)); + dbot.say(data.channel, dbot.t('spelling_other', e)); }); } else { if(last.hasOwnProperty(data.channel)) {