View | Details | Raw Unified | Return to bug 25922
Collapse All | Expand All

(-)a/misc/translator/tmpl_process3.pl (-3 / +3 lines)
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/;
(-)a/misc/translator/xgettext.pl (-3 / +2 lines)
Lines 117-123 sub text_extract { Link Here
117
            # value [tag=input], meta
117
            # value [tag=input], meta
118
            my $tag;
118
            my $tag;
119
            $tag = lc($1) if $t =~ /^<(\S+)/s;
119
            $tag = lc($1) if $t =~ /^<(\S+)/s;
120
            for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder') {
120
            for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder', 'arial-label') {
121
                if ($attr->{$a}) {
121
                if ($attr->{$a}) {
122
                    next if $a eq 'label' && $tag ne 'optgroup';
122
                    next if $a eq 'label' && $tag ne 'optgroup';
123
                    next if $a eq 'content' && $tag ne 'meta';
123
                    next if $a eq 'content' && $tag ne 'meta';
Lines 126-132 sub text_extract { Link Here
126
                    my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME
126
                    my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME
127
                    $val = TmplTokenizer::trim($val);
127
                    $val = TmplTokenizer::trim($val);
128
                    # for selected attributes replace '[%..%]' with '%s' globally
128
                    # for selected attributes replace '[%..%]' with '%s' globally
129
                    if ( $a =~ /title|value|alt|content|placeholder/ ) {
129
                    if ( $a =~ /title|value|alt|content|placeholder|aria-label/ ) {
130
                        $val =~ s/\[\%.*?\%\]/\%s/g;
130
                        $val =~ s/\[\%.*?\%\]/\%s/g;
131
                    }
131
                    }
132
                    # save attribute text for translation
132
                    # save attribute text for translation
133
- 

Return to bug 25922