summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm6
-rw-r--r--FS/FS/msgcat.pm11
2 files changed, 14 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index b39c8217d..6e588208a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -873,6 +873,12 @@ httemplate/docs/config.html
'select_enum' => [ qw(CARD PREPAY BILL COMP) ],
},
+ {
+ 'key' => 'show-msgcat-codes',
+ 'section' => 'UI',
+ 'description' => 'Show msgcat codes in error messages. Turn this option on before reporting errors to the mailing list.',
+ 'type' => 'checkbox',
+ },
);
diff --git a/FS/FS/msgcat.pm b/FS/FS/msgcat.pm
index 53a7aeee6..3eca14b83 100644
--- a/FS/FS/msgcat.pm
+++ b/FS/FS/msgcat.pm
@@ -1,7 +1,7 @@
package FS::msgcat;
use strict;
-use vars qw( @ISA @EXPORT_OK $conf $locale );
+use vars qw( @ISA @EXPORT_OK $conf $locale $debug );
use Exporter;
use FS::UID;
use FS::Record qw( qsearchs );
@@ -13,6 +13,7 @@ use FS::Conf;
$FS::UID::callback{'msgcat'} = sub {
$conf = new FS::Conf;
$locale = $conf->config('locale') || 'en_US';
+ $debug = $conf->exists('show-msgcat-codes')
};
=head1 NAME
@@ -140,6 +141,10 @@ Returns the full message for the supplied message code.
=cut
sub gettext {
+ $debug ? geterror(@_) : _gettext(@_);
+}
+
+sub _gettext {
my $msgcode = shift;
my $msgcat = qsearchs('msgcat', {
'msgcode' => $msgcode,
@@ -163,7 +168,7 @@ code.
sub geterror {
my $msgcode = shift;
- my $msg = gettext($msgcode);
+ my $msg = _gettext($msgcode);
if ( $msg eq $msgcode ) {
"Error code $msgcode (message for locale $locale not found)";
} else {
@@ -175,7 +180,7 @@ sub geterror {
=head1 BUGS
-i18n/l10n is a mess.
+i18n/l10n, eek
=head1 SEE ALSO