Author: dylan
Date: 2004-05-27 02:02:48 -0400 (Thu, 27 May 2004)
New Revision: 171

Modified:
   trunk/haver-client/lib/Haver/Formats/Error.pm
Log:
Haver::Formats::Error now uses Locale::gettext.


Modified: trunk/haver-client/lib/Haver/Formats/Error.pm
===================================================================
--- trunk/haver-client/lib/Haver/Formats/Error.pm       2004-05-27 04:47:45 UTC 
(rev 170)
+++ trunk/haver-client/lib/Haver/Formats/Error.pm       2004-05-27 06:02:48 UTC 
(rev 171)
@@ -21,112 +21,94 @@
 use strict;
 
 use base qw( Exporter );
+use Locale::gettext;
 
+my $old_text_domain = textdomain('haver-errors');
+
 our $VERSION = "0.02";
 our @EXPORT = qw( );
 our @EXPORT_OK = (@EXPORT, qw( %Errors ));
 
+sub T { gettext($_[0]) }
+
 our %Errors = (
-       WANT           => [
-               'want unsatisfied',
-               'Server wanted #1, but got #2',
-               ['expected', 'got'],
+       WANT => [
+               T('Unsatisfied want'),
+               T('Wanted "#1", but got "#2" instead!'),
        ],
-       CANT_WRONG     => [
-               'cant on unwanted thing',
-               "Server didn't want anything, and got #1",
+       SPEEDY => [
+               T('Client too fast'),
+               T('Client issued unwanted command before being accepted'),
        ],
-       UID_IN_USE     => [
-               'uid is in use',
-               'Server says the uid #1 is already being used by someone else.',
+       UCMD => [
+               T('Unknown command'),
+               T('Command "#1" is not recognized by this server'),
        ],
-       CID_IN_USE     => [
-               'cid is in use',
-               'Server says the cid #1 already exists',
-               ['cid'],
+       UNSUPPORTED_MODE => [
+               T('Unsupported mode'),
+               T('The mode "#1" is not recognized by this server.'),
        ],
-       CID_NOT_FOUND  => [
-               'unknown channel id',
-               'Server says the channel #1 does not exist.',
+       UID_INVALID => [
+               T('Invalid user id'),
+               T('"#1" is an invalid user id; it contains illegal 
characters.'),
        ],
-       UID_NOT_FOUND  => [
-               'unknown user id',
-               'Server says the user #1 does not exist.',
+       UID_IN_USE => [
+               T('User id is in use'),
+               T('The user id #1 is already being used'),
        ],
-       UID_INVALID    => [
-               'invalid uid',
-               'Server says the uid #1 is not valid.',
+       UID_NOT_FOUND => [
+               T('User does not exist'),
+               T('The user #1 does not exist'),
        ],
-       UID_RESERVED   => [
-               'uid is reserved',
-               'Server says the uid #1 is reserved for future use.',
+       CID_INVALID => [
+               T('Invalid channel id'),
+               T('The channel id "#1" is invalid.'),
        ],
-       BUG            => [
-               'this should never happen',
-               'Server has encountered something that should never happen...',
+       CID_NOT_FOUND => [
+               T('Channel does not exist'),
+               T('Channel #1 does not exist'),
        ],
-       UCMD            => [
-               'unknown command',
-               'Server does not recognize the command #1',
+       LOAD_USER => [
+               T('Failed to load user profile'),
+               T('Failed to load the user profile. Please report this to the 
server admin.'),
        ],
-       ALREADY_JOINED  => [
-               'already joined to channel',
-               'Server says you are already in the channel #1.',
-               ['channel'],
+       CANT => [
+               T('Server demands, client refuses'),
+               T('#1 is mandatory, yet the client refused to send it.'),
        ],
-       NOT_JOINED_PART => [
-               'not joined to channel',
-               'Server says you can not part #1 because you are not in there 
to begin with.',
+       CANT_WRONG => [
+               T('Celebrity steel cage monkey boxing'),
+               T('Wanted #1, client refused #2. Your client is broken.'),
        ],
-       FIELD_NOT_FOUND => [
-               'field not defined',
-               'Server says the field #1 does not exist on that object',
-               ['field'],
+       ALREADY_JOINED => [
+               T('Already in channel'),
+               T("Already joined to channel #1"),
        ],
-       ARG_INVALID => [
-               'argument not valid',
-               'Server says argument number #2 to command #1 is invalid.',
-               ['command name', 'argument number'],
+       NOT_JOINED_PART => [
+               T("Can't leave before arrival"),
+               T("You can't leave #1, because you're not there to begin 
with."),
        ],
+       NEED_IN => [
+               T("IN is required for this command"),
+               T('#1 needs to be prefixed with "IN  $cid"'),
+       ],
        UNEXPECTED_PONG => [
-               'pong not expected',
-               'Server did not expect client to send PONG.',
-               [],
+               T("la razon de la sinrazon"),
+               T("hmm, the client sent a PONG and the server doesn't remember 
sending a pong."),
        ],
-       SPEEDY => [
-               'you are too fast',
-               'Server does not like you to speak unless asked until you are 
accepted...',
-               [],
-       ],
-       PASS_INVALID => [
-               'password is invalid',
-               'Server says the password you sent was invalid.',
-               [],
-       ],
        ACCESS => [
-               'access denied',
-               'Server says you are not allowed to access the #1 command',
-               ['command'],
+               T('Access denied'),
+               T("You don't have access to the #1 command"),
        ],
-       TAG_INVALID => [
-               'tag invalid',
-               '#1 is an invalid tag',
-               ['tag'],
-       ],
-       CID_INVALID => [
-               'invalid cid',
-               '#1 is not a valid CID, it contains illegal characters.',
-               ['cid'],
-       ],
-       NS_NOT_FOUND => [
-               'namespace not found',
-               'The namespace #1 was not found',
-               ['namespace'],
-       ],
-
-
+       PERM  => [
+               T('Permission denied'),
+               T('You lack the "#1" permision'),
+       ],      
+       
 );
 
+textdomain($old_text_domain);
+
 sub new {
        my ($this) = @_;
        return $this;


Reply via email to