Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Links Error Codes / Language

Quote Reply
Links Error Codes / Language
Code:
# Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = Links::language('ADD_NOTNULL');
local $Links::Link::ERRORS->{NOCATEGORY} = Links::language('ADD_NOCATEGORY');
$Links::Link::ERRORS ||= {}; # silence -w

# Add the record.
my $id = $db->add ( $input );
$input->{ID} = $id;
if (! $id) {
my $error = "<ul><li>" . join ("<li>", $db->error) . "</ul>";
return { error => "<ul>$error</ul>", Category => $category };
}


Alex,

Could you explain why/when you'd need to assign the error values to the SQL module?




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Links Error Codes / Language In reply to
Hi,

You need to do this so the error in GT::SQL is using the language variables found in language.txt (i.e. so instead of Column '%s' can not be left blank, it's translated into another language).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Links Error Codes / Language In reply to
I'm confused now.

I thought the whole purpose of the language.txt file was to avoid having to do things like that.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.