Bugzilla – Attachment 106509 Details for
Bug 25922
aria-labels are currently not translatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25922: Add aria-label to the allowlist for translation
Bug-25922-Add-aria-label-to-the-allowlist-for-tran.patch (text/plain), 3.34 KB, created by
Julian Maurice
on 2020-07-03 13:38:01 UTC
(
hide
)
Description:
Bug 25922: Add aria-label to the allowlist for translation
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-07-03 13:38:01 UTC
Size:
3.34 KB
patch
obsolete
>From aa9208970ee313bda0951ea90495ae25ea6d1833 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >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 > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25922
:
106501
|
106509
|
106510
|
106532
|
106533