[wellwell-devel] [wellwell/zoom] Fix PDF translation by switching the locale with [setlocale].
Git
wellwell-devel at rt.icdevgroup.org
Tue Feb 8 14:00:01 UTC 2011
commit 295c0fd9f671d6d02422c40a5d81fc5cbe1c19c9
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Tue Feb 8 14:58:40 2011 +0100
Fix PDF translation by switching the locale with [setlocale].
lib/Vend/PDF.pm | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/PDF.pm b/lib/Vend/PDF.pm
index 0b59b40..25f6821 100644
--- a/lib/Vend/PDF.pm
+++ b/lib/Vend/PDF.pm
@@ -39,7 +39,7 @@ Vend::Config::parse_tag('UserTag', 'pdf MapRoutine Vend::PDF::pdf');
# [pdf]
sub pdf {
my ($specification, $template, $output, $opt) = @_;
- my (%input);
+ my (%input, $locale);
# input for Zoom template
if (exists $opt->{input}) {
@@ -59,12 +59,20 @@ sub pdf {
my ($i18n, $sub);
if ($opt->{locale}) {
+ $locale = Vend::Tags->setlocale({get => 1});
+
+ Vend::Tags->setlocale($opt->{locale});
+
$sub = sub {
my $text = shift;
+ my $out;
- return Vend::Tags->filter({op => "loc.$opt->{locale}", body => $text});
+ $out = ::errmsg($text);
+
+ return $out;
};
+
$i18n = new Template::Zoom::I18N ($sub);
}
@@ -116,6 +124,10 @@ sub pdf {
$pdf->process($output);
+ if ($opt->{locale}) {
+ Vend::Tags->setlocale($locale);
+ }
+
return;
}
More information about the wellwell-devel
mailing list