Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add i18n support to [pdf] tag.
  • Loading branch information
racke committed Dec 17, 2010
1 parent d61d03f commit 3dd0087
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Vend/PDF.pm
Expand Up @@ -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');
Expand All @@ -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);

Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit 3dd0087

Please sign in to comment.