Lines 64-70
sub text_replace_tag {
Link Here
|
64 |
# value [tag=input], meta |
64 |
# value [tag=input], meta |
65 |
my $tag = ($t =~ /^<(\S+)/s) ? lc($1) : undef; |
65 |
my $tag = ($t =~ /^<(\S+)/s) ? lc($1) : undef; |
66 |
my $translated_p = 0; |
66 |
my $translated_p = 0; |
67 |
for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder') { |
67 |
for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder', 'aria-label') { |
68 |
if ($attr->{$a}) { |
68 |
if ($attr->{$a}) { |
69 |
next if $a eq 'label' && $tag ne 'optgroup'; |
69 |
next if $a eq 'label' && $tag ne 'optgroup'; |
70 |
next if $a eq 'content' && $tag ne 'meta'; |
70 |
next if $a eq 'content' && $tag ne 'meta'; |
Lines 73-79
sub text_replace_tag {
Link Here
|
73 |
my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME |
73 |
my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME |
74 |
if ($val =~ /\S/s) { |
74 |
if ($val =~ /\S/s) { |
75 |
# for selected attributes replace '[%..%]' with '%s' and remember matches |
75 |
# for selected attributes replace '[%..%]' with '%s' and remember matches |
76 |
if ( $a =~ /title|value|alt|content|placeholder/ ) { |
76 |
if ( $a =~ /title|value|alt|content|placeholder|aria-label/ ) { |
77 |
while ( $val =~ s/(\[\%.*?\%\])/\%s/ ) { |
77 |
while ( $val =~ s/(\[\%.*?\%\])/\%s/ ) { |
78 |
my $var = $1; |
78 |
my $var = $1; |
79 |
push @ttvar, $1; |
79 |
push @ttvar, $1; |
Lines 82-88
sub text_replace_tag {
Link Here
|
82 |
# find translation for transformed attributes |
82 |
# find translation for transformed attributes |
83 |
my $s = find_translation($val); |
83 |
my $s = find_translation($val); |
84 |
# replace '%s' with original content (in order) on translated string, this is fragile! |
84 |
# replace '%s' with original content (in order) on translated string, this is fragile! |
85 |
if ( $a =~ /title|value|alt|content|placeholder/ and @ttvar ) { |
85 |
if ( $a =~ /title|value|alt|content|placeholder|aria-label/ and @ttvar ) { |
86 |
while ( @ttvar ) { |
86 |
while ( @ttvar ) { |
87 |
my $var = shift @ttvar; |
87 |
my $var = shift @ttvar; |
88 |
$s =~ s/\%s/$var/; |
88 |
$s =~ s/\%s/$var/; |