From ff32c03cb19f74136856a4d8d334c8c5bb9b687e Mon Sep 17 00:00:00 2001 From: koha-preprod Date: Mon, 7 Feb 2011 15:59:18 -0500 Subject: [PATCH] Adding the ability to translate HTML5 placeholder text in an input field --- misc/translator/text-extract.pl | 4 ++++ misc/translator/text-extract2.pl | 2 +- misc/translator/tmpl_process3.pl | 2 +- misc/translator/xgettext.pl | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/misc/translator/text-extract.pl b/misc/translator/text-extract.pl index 4e2fbdc..aeb0467 100755 --- a/misc/translator/text-extract.pl +++ b/misc/translator/text-extract.pl @@ -28,6 +28,10 @@ getopt("f:"); if (ref($c) && $c->tag() eq 'meta') { print $c->attr('content')."\n "; } + if (ref($c) && $c->tag() eq "input" && $c->attr('placeholder')) { + print $c->attr('placeholder')."\n"; + } + give_id($c) if ref $c; # ignore text nodes } }; diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index 452fd89..d8fd701 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -85,7 +85,7 @@ sub text_extract ($) { } elsif ($kind == 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', 'placeholder') { if ($attr->{$a}) { next if $a eq 'content' && $tag ne 'meta'; next if $a eq 'value' && ($tag ne 'input' diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index b916cab..29e04cd 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -51,7 +51,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') { + for my $a ('alt', 'content', 'title', 'value','label', 'placeholder') { if ($attr->{$a}) { next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl index abe315e..56bf777 100755 --- a/misc/translator/xgettext.pl +++ b/misc/translator/xgettext.pl @@ -98,7 +98,7 @@ 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','label') { + for my $a ('alt', 'content', 'title', 'value', 'label', 'placeholder') { if ($attr->{$a}) { next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; -- 1.5.6.5