automatically translate label and hoverHelp property elements for assets

This commit is contained in:
Graham Knop 2009-10-21 18:08:12 -05:00
parent 25931b67d4
commit 0e94b4a783
2 changed files with 68 additions and 0 deletions

View file

@ -18,6 +18,7 @@ use strict;
use warnings;
use 5.010;
use base qw(WebGUI::Definition);
use WebGUI::International;
our $VERSION = '0.0.1';
@ -40,5 +41,21 @@ sub import {
goto $next;
}
sub _gen_getProperty {
my $class = shift;
my $superGetProperty = $class->next::method(@_);
return sub {
my $self = shift;
my $property = $self->$superGetProperty(@_);
for my $element (qw(label hoverHelp)) {
if ($property->{$element} && ref $property->{$element} eq 'ARRAY') {
$property->{$element}
= WebGUI::International->new($self->session)->get(@{$property->{$element}});
}
}
return $property;
};
}
1;