From f16bedc6358acc6c07a52ed7aca9586a0cd4f097 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. To test: - Apply patches from here and bug 25244 - kshell - cd misc/translator - perl translate update de-DE - Check for the aria-label in the diff - Verify the strings appear in the po files now - Translate them - perl translate install de-DE - Verify the translated strings appear in the template Signed-off-by: Julian Maurice Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 280f1bdeb3cbec9f57d71e980490e32af61eecfb) Signed-off-by: Lucas Gass (cherry picked from commit 21be26f25b7f60c0cadfe247b8efc66cf733551b) Signed-off-by: Aleisha Amohia --- 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 68c58f0cc6..34794a58e7 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 = lc($1) if $t =~ /^<(\S+)/s; 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 889baf64a7..5620e1f3e4 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.39.5