From de9136abbfdef562e112595c6594e4c2e85ee364 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 3 Jul 2020 14:07:25 +0100 Subject: [PATCH] Bug 25922: Add aria-label to the allowlist for translation This patch adds aria-label to the allowlist for translations --- misc/translator/tmpl_process3.pl | 6 +++--- misc/translator/xgettext.pl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index 45a9b6e7a8..9221430c35 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -64,7 +64,7 @@ sub text_replace_tag { # value [tag=input], meta my $tag = ($t =~ /^<(\S+)/s) ? lc($1) : undef; my $translated_p = 0; - for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder') { + for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder', 'aria-label') { if ($attr->{$a}) { next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; @@ -73,7 +73,7 @@ sub text_replace_tag { my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME if ($val =~ /\S/s) { # for selected attributes replace '[%..%]' with '%s' and remember matches - if ( $a =~ /title|value|alt|content|placeholder/ ) { + if ( $a =~ /title|value|alt|content|placeholder|aria-label/ ) { while ( $val =~ s/(\[\%.*?\%\])/\%s/ ) { my $var = $1; push @ttvar, $1; @@ -82,7 +82,7 @@ sub text_replace_tag { # find translation for transformed attributes my $s = find_translation($val); # replace '%s' with original content (in order) on translated string, this is fragile! - if ( $a =~ /title|value|alt|content|placeholder/ and @ttvar ) { + if ( $a =~ /title|value|alt|content|placeholder|aria-label/ and @ttvar ) { while ( @ttvar ) { my $var = shift @ttvar; $s =~ s/\%s/$var/; diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl index afac244c6c..54360a1971 100755 --- a/misc/translator/xgettext.pl +++ b/misc/translator/xgettext.pl @@ -117,7 +117,7 @@ sub text_extract { # value [tag=input], meta my $tag; $tag = lc($1) if $t =~ /^<(\S+)/s; - for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder') { + for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder', 'arial-label') { if ($attr->{$a}) { next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; @@ -126,7 +126,7 @@ sub text_extract { my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME $val = TmplTokenizer::trim($val); # for selected attributes replace '[%..%]' with '%s' globally - if ( $a =~ /title|value|alt|content|placeholder/ ) { + if ( $a =~ /title|value|alt|content|placeholder|aria-label/ ) { $val =~ s/\[\%.*?\%\]/\%s/g; } # save attribute text for translation -- 2.20.1