From 98bf67beec8146523b6bd674f63b742e873eb67d Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Sun, 13 Dec 2009 19:20:39 +0100 Subject: [PATCH] Adding optgroup labels to translations --- misc/translator/tmpl_process3.pl | 3 ++- misc/translator/xgettext.pl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index 8bf92bf2e4..80325d077f 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -50,8 +50,9 @@ 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') { + for my $a ('alt', 'content', 'title', 'value','label') { if ($attr->{$a}) { + next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl index 8e1dfd7951..031f9ba4e6 100755 --- a/misc/translator/xgettext.pl +++ b/misc/translator/xgettext.pl @@ -98,8 +98,9 @@ sub text_extract (*) { } elsif ($kind eq TmplTokenType::TAG && %$attr) { # value [tag=input], meta my $tag = lc($1) if $t =~ /^<(\S+)/s; - for my $a ('alt', 'content', 'title', 'value') { + for my $a ('alt', 'content', 'title', 'value','label') { if ($attr->{$a}) { + next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:hidden|radio|checkbox)$/)); # FIXME -- 2.39.5