Gossamer Forum
Home : Products : DBMan SQL : Discussion :

User Language

Quote Reply
User Language
How can I make ALL the user language tags (e.g ADD_ILLEGALVAL, ADD_NOTNULL, etc.) available for use in a custom perl module in my admin/Dbsql directory??

In the case of the Template Globals I added -

#Include the current tags
my $tags = GT::Template->tags;

which made all the globals available but I need to have the user language tags (Code) available as well.

I'm generating additional error messages based on the contents of $tags->{msg} as follows -

#Include the current tags
my $tags = GT::Template->tags;
my
$error_msg=$tags->{msg};

my $language_msg = ???????;

if ($error_msg =~ /\b$language_msg\b/) {

#do something

}


I guess the ????? needs to be something like $language->{ADD_NOTNULL} or similar but I don't know exactly what.

Can anyone tell me how to make All the user language tags available and how to refer to them?

Note: I need to use the ADD_ILLEGALVAL, ADD_NOTNULL, etc. tags rather than the actual value (e.g "Column %s cannot be left blank.") as the value will change with different languages.

Thank you.

Simon.
Quote Reply
Re: [jai] User Language In reply to
You should add the code below before modifing a record

#Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');


Ensure that ADD_ILLEGALVAL, ADD_UNIQUE and ADD_NOTNULL are available in language.txt

TheStone.

B.
Quote Reply
Re: [TheStone] User Language In reply to
Sorry I tried everything but I still can't get it to work.

Where should I add -

#Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');


At the begining of my custom perl module??

Or in my sub as per my previous example -

#Include the current tags
my $tags = GT::Template->tags;
my $error_msg=$tags->{msg};
#Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');
my $language_msg = ???????;
if ($error_msg =~ /\b$language_msg\b/) {
#do something
}


Do I use -

my $language_msg = $self->_language('ADD_NOTNULL');

for the ????????

Please explain a little more.

Thank you.

Simon.

Quote Reply
Re: [jai] User Language In reply to
Have a look at the modify_record subroutine around line #818 which will show you how to setup the language for GT::SQL.

TheStone.

B.
Quote Reply
Re: [TheStone] User Language In reply to
I appreciate your help but I still can't get this to work.

I'm generating additional error messages based on the contents of $tags->{msg} as follows -

#Include the current tags
my $tags = GT::Template->tags;
my
$error_msg=$tags->{msg};

my $language_msg = ???????;

if ($error_msg =~ /\b$language_msg\b/) {

#do something

}

#repeat for each error message

What I want to do is check the value (contents) of $tags->{msg} to see if it contains any of the error messages in my language.txt but I don't know how to make the error messages available in my custom perl module and also how to refer to them. So what i need to know is -

1/ What code to add to make the language.txt tags available?

From previous replies it would apear to be -

#Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');


IS THIS CORRECT?

2/ How to call up or refer to the error messages in my example -

my $language_msg = ???????;

What should the ??????? be ?

Thank you.

Simon.

Quote Reply
Re: [jai] User Language In reply to
You can get it by using $tags->{home}->_language(message_code) instead of $self->_language(message_code)

TheStone.

B.

Last edited by:

TheStone: Nov 14, 2002, 9:50 AM