4 use vars qw( @ISA @EXPORT_OK $conf $locale $debug );
7 #use FS::Record qw( qsearchs ); # wtf? won't import...
9 #use FS::Conf; #wtf? causes dependency loops too.
13 @EXPORT_OK = qw( gettext geterror );
15 FS::UID->install_callback( sub {
19 $locale = $conf->config('locale') || 'en_US';
20 $debug = $conf->exists('show-msgcat-codes')
25 FS::Msgcat - Message catalog functions
29 use FS::Msgcat qw(gettext geterror);
31 #simple interface for retreiving messages...
32 $message = gettext('msgcode');
33 #or errors (includes the error code)
34 $message = geterror('msgcode');
38 FS::Msgcat provides functions to use the message catalog. If you want to
39 maintain the message catalog database, see L<FS::msgcat> instead.
47 Returns the full message for the supplied message code.
52 $debug ? geterror(@_) : _gettext(@_);
57 my $msgcat = FS::Record::qsearchs('msgcat', {
58 'msgcode' => $msgcode,
64 warn "WARNING: message for msgcode $msgcode in locale $locale not found";
70 =item geterror MSGCODE
72 Returns the full message for the supplied message code, including the message
79 my $msg = _gettext($msgcode);
80 if ( $msg eq $msgcode ) {
81 "Error code $msgcode (message for locale $locale not found)";
83 "$msg (error code $msgcode)";
95 L<FS::msgcat>, L<FS::Record>, schema.html from the base documentation.