4 use vars qw( @ISA @EXPORT_OK $conf $locale $debug );
7 #use FS::Record qw( qsearchs ); # wtf? won't import...
13 @EXPORT_OK = qw( gettext geterror );
15 $FS::UID::callback{'Msgcat'} = sub {
17 $locale = $conf->config('locale') || 'en_US';
18 $debug = $conf->exists('show-msgcat-codes')
23 FS::Msgcat - Message catalog functions
27 use FS::Msgcat qw(gettext geterror);
29 #simple interface for retreiving messages...
30 $message = gettext('msgcode');
31 #or errors (includes the error code)
32 $message = geterror('msgcode');
36 FS::Msgcat provides functions to use the message catalog. If you want to
37 maintain the message catalog database, see L<FS::msgcat> instead.
45 Returns the full message for the supplied message code.
50 $debug ? geterror(@_) : _gettext(@_);
55 my $msgcat = FS::Record::qsearchs('msgcat', {
56 'msgcode' => $msgcode,
62 warn "WARNING: message for msgcode $msgcode in locale $locale not found";
68 =item geterror MSGCODE
70 Returns the full message for the supplied message code, including the message
77 my $msg = _gettext($msgcode);
78 if ( $msg eq $msgcode ) {
79 "Error code $msgcode (message for locale $locale not found)";
81 "$msg (error code $msgcode)";
93 L<FS::msgcat>, L<FS::Record>, schema.html from the base documentation.