Commit 3cc715d9 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

xgettext.pl: Support [% "..." | loc %] in templates.

parent 518284a5
......@@ -305,7 +305,7 @@ foreach my $file (@ordered_files) {
);
}
# Template Toolkit
# Template Toolkit: [%|loc(...)%]...[%END%]
$line = 1;
pos($_) = 0;
while (
......@@ -326,6 +326,41 @@ foreach my $file (@ordered_files) {
&add_expression($expression);
}
# Template Toolkit: [% "..." | loc(...) %]
$line = 1;
pos $_ = 0;
while (m{
\G .*?
\[ % [-=~+]? \s*
(?: \' ((?:\\|\.|[^'])*) \' | \" ((?:\\|\.|[^"])*) \" ) \s*
\| \s*
($available_tags)
(.*?)
\s* [-=~+]? % \]
}sgx) {
my $str = $1 || $2;
my $this_tag = $3;
my $vars = $4;
$line += (() = ($& =~ /\n/g));
$str =~ s{\\(.)}{
($1 eq 't') ? "\t" :
($1 eq 'n') ? "\n" :
($1 eq 'r') ? "\r" :
$1
}eg;
$vars =~ s/^\s*[(](.*?)[)].*/$1/ or $vars = '';
my $expression = {
'expression' => $str,
'filename' => $filename,
'line' => $line,
'vars' => $vars
};
$expression->{'type'} = 'date' if ($this_tag eq 'locdt');
&add_expression($expression);
}
# Template Toolkit with ($tag$%|loc%$tag$)...($tag$%END%$tag$) in archives
$line = 1;
pos($_) = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment