summaryrefslogtreecommitdiff
path: root/lib/JWebmail/I18N.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/I18N.pm')
-rw-r--r--lib/JWebmail/I18N.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/JWebmail/I18N.pm b/lib/JWebmail/I18N.pm
index 576c413..190f4be 100644
--- a/lib/JWebmail/I18N.pm
+++ b/lib/JWebmail/I18N.pm
@@ -1,8 +1,40 @@
package JWebmail::I18N;
+use v5.22;
+use warnings;
+use utf8;
+
use parent 'Locale::Maketext';
+sub init {
+ my $self = shift;
+ $self->SUPER::init(@_);
+
+ $self->fail_with('log_on_failure');
+}
+
+sub fallback_languages { return (); }
+
+sub log_on_failure {
+ my $self = shift;
+ my $prase = shift;
+ $self->logger->("missing translation for @{[$self->language_tag]}:'$prase'");
+ $self->failure_handler_auto($prase, @_);
+}
+
+sub logger {
+ my $self = shift;
+ if (@_) {
+ $self->{_jwm_logger} = $_[0];
+ return $self;
+ }
+ else {
+ return $self->{_jwm_logger};
+ }
+}
+
+
1
__END__