]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Template/Plugin/T8.pm
T8 Filter für Templates und Anwendungsbeispiel _payments
[mfinanz.git] / SL / Template / Plugin / T8.pm
diff --git a/SL/Template/Plugin/T8.pm b/SL/Template/Plugin/T8.pm
new file mode 100644 (file)
index 0000000..79fab96
--- /dev/null
@@ -0,0 +1,24 @@
+package SL::Template::Plugin::T8;
+
+use Template::Plugin::Filter;
+use base qw( Template::Plugin::Filter );
+
+my $locale = undef;
+
+sub init {
+    my $self = shift;
+
+    $locale ||= Locale->new($main::myconfig{countrycode}, 'all');
+
+    # first arg can specify filter name
+    $self->install_filter($self->{ _ARGS }->[0] || 'T8');
+
+    return $self;
+}
+
+sub filter {
+    my ($self, $text, $args) = @_;
+    return $locale->text($text, @{ $args || [] });
+}
+
+return 'SL::Template::Plugin::T8';