[wellwell-devel] [wellwell/zoom] Add i18n support to [pdf] tag.

Git wellwell-devel at rt.icdevgroup.org
Fri Dec 17 14:11:30 UTC 2010


commit 3dd0087210ffbcd3b346bd51a8cee9c247a83345
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Dec 17 15:08:36 2010 +0100

    Add i18n support to [pdf] tag.

 lib/Vend/PDF.pm |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/lib/Vend/PDF.pm b/lib/Vend/PDF.pm
index 373bbd9..0b59b40 100644
--- a/lib/Vend/PDF.pm
+++ b/lib/Vend/PDF.pm
@@ -24,10 +24,12 @@ use Template::Zoom::HTML;
 use Template::Zoom::Database::Rose;
 use Template::Zoom::Style::CSS;
 use Template::Zoom;
+use Template::Zoom::I18N;
 use Template::Zoom::PDF;
 
 use Vend::Config;
 use Vend::Data;
+use Vend::Tags;
 
 # define [pdf] tag
 Vend::Config::parse_tag('UserTag', 'pdf Order specification template output');
@@ -53,6 +55,20 @@ sub pdf {
 		die "$0: error parsing $xml_file: " . $xml_spec->error() . "\n";
 	}
 
+	# i18n
+	my ($i18n, $sub);
+
+	if ($opt->{locale}) {
+		$sub = sub {
+			my $text = shift;
+
+			return Vend::Tags->filter({op => "loc.$opt->{locale}", body => $text});
+
+		};
+		$i18n = new Template::Zoom::I18N ($sub);
+		
+	}
+
 	# parse template
 	my ($html_object);
 
@@ -84,6 +100,7 @@ sub pdf {
 	my ($zoom);
 
 	$zoom = new Template::Zoom (template => $html_object,
+		i18n => $i18n,
 		database => $rose,
 		filters => $opt->{filters},
 		values => $opt->{values},



More information about the wellwell-devel mailing list