From 676c08ad8eb7314f437a7d46640878850b237de8 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Oct 2010 13:35:23 +0100 Subject: [PATCH 1/2] Fix possible truncation of messages Possible bug with languages which has a long translation for '(XX more messages)'. --- src/callbacks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index 8f9cdf53d..35bd21973 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -852,8 +852,11 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): allowedLength = conf.get(conf.supybot.reply.mores.length, target) if not allowedLength: # 0 indicates this. - allowedLength = 450 - len(self.irc.prefix) + allowedLength = 470 - len(self.irc.prefix) allowedLength -= len(msg.nick) + # The '(XX more messages)' may have not the same + # length in the current locale + allowedLength -= len(_('(XX more messages)')) maximumMores = conf.get(conf.supybot.reply.mores.maximum, target) maximumLength = allowedLength * maximumMores @@ -866,7 +869,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): # In case we're truncating, we add 20 to allowedLength, # because our allowedLength is shortened for the # "(XX more messages)" trailer. - s = s[:allowedLength+20] + s = s[:allowedLength+len(_('(XX more messages)'))] # There's no need for action=self.action here because # action implies noLengthCheck, which has already been # handled. Let's stick an assert in here just in case. From 4c03aef9a6492819c4dd182f705bf00db9adba2f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Oct 2010 13:41:36 +0100 Subject: [PATCH 2/2] Internationalize a string in conf.py --- src/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf.py b/src/conf.py index b9ec624ce..521a944fd 100644 --- a/src/conf.py +++ b/src/conf.py @@ -611,9 +611,9 @@ registerChannelValue(supybot.commands.nested, 'pipeSyntax', example: 'bot: foo | bar'."""))) registerGroup(supybot.commands, 'defaultPlugins', - orderAlphabetically=True, help="""Determines what commands have default + orderAlphabetically=True, help=_("""Determines what commands have default plugins set, and which plugins are set to be the default for each of those - commands.""") + commands.""")) registerGlobalValue(supybot.commands.defaultPlugins, 'importantPlugins', registry.SpaceSeparatedSetOfStrings( ['Admin', 'Channel', 'Config', 'Misc', 'Owner', 'Plugin', 'User'],