sub text_extract (*) {
my($h) = @_;
# Compiled pattern to ignore useless strings
my $useless = qr/^(›|%%|%s|\s|\d|\.|,|;|:|\?|\!|\*|#|-|\+|x|=|~|<|>|\||\/|\\|\(|\)|\[|\]|\{|\}|"|')*$/;
for (;;) {
my $s = TmplTokenizer::next_token $h;
last unless defined $s;
my($kind, $t, $attr) = ($s->type, $s->string, $s->attributes);
my $tmpt = $t;
next if ( $t =~ $useless );
# If msgid contains only placeholders and/or spaces, ignore it
$tmpt =~ s/(%s|\s)//g;
next if ($tmpt eq "");
if ($kind eq C4::TmplTokenType::TEXT) {
if ($t =~ /\S/s && $t !~ /<!/){
-