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 <julian.maurice@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2020-07-03 14:07:25 +01:00 committed by Jonathan Druart
parent 6b49a70b94
commit 280f1bdeb3
2 changed files with 5 additions and 5 deletions

View File

@ -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/;

View File

@ -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