- Consider <INPUT type=text> and <INPUT type=text> part of strings.

- If a string is enclosed by a tag, remove that tag from the extracted string
- Generate automatic comments to provide more information for the translator
- A couple bug fixes
This commit is contained in:
acli 2004-02-27 13:26:07 +00:00
parent 5d18fec42f
commit 66775a8646
6 changed files with 1411 additions and 526 deletions

View file

@ -82,9 +82,12 @@ sub set_children {
# only meaningful for TEXT_PARAMETRIZED tokens
# FIXME: DIRECTIVE is not necessarily TMPL_VAR !!
sub parameters {
sub parameters_and_fields {
my $this = shift;
return map { $_->type == TmplTokenType::DIRECTIVE? $_: ()} @{$this->{'_kids'}};
return map { $_->type == TmplTokenType::DIRECTIVE? $_:
($_->type == TmplTokenType::TAG
&& $_->string =~ /^<input\b/is)? $_: ()}
@{$this->{'_kids'}};
}
# only meaningful for TEXT_PARAMETRIZED tokens

View file

@ -484,9 +484,9 @@ sub _token_groupable1_p ($) { # as first token, groupable into TEXT_PARAMETRIZED
|| ($t->type == TmplTokenType::DIRECTIVE
&& $t->string =~ /^(?:$re_tmpl_var)$/os)
|| ($t->type == TmplTokenType::TAG
&& ($t->string =~ /^<(?:b|em|h[123456]|i|u)\b/is
# || ($t->string =~ /^<input\b/is
# && $t->attributes->{'type'}->[1] =~ /^(?:radio|text)$/is)
&& ($t->string =~ /^<(?:a|b|em|h[123456]|i|u)\b/is
|| ($t->string =~ /^<input\b/is
&& $t->attributes->{'type'}->[1] =~ /^(?:radio|text)$/is)
))
}
@ -498,7 +498,7 @@ sub _token_groupable2_p ($) { # as other token, groupable into TEXT_PARAMETRIZED
|| ($t->type == TmplTokenType::TAG
&& ($t->string =~ /^<\/?(?:a|b|em|h[123456]|i|u)\b/is
|| ($t->string =~ /^<input\b/is
&& $t->attributes->{'type'} =~ /^(?:radio|text)$/is)))
&& $t->attributes->{'type'}->[1] =~ /^(?:radio|text)$/is)))
}
sub _quote_cformat ($) {
@ -528,7 +528,9 @@ sub _formalize ($) {
_formalize_string_cformat($t->string):
$t->type == TmplTokenType::TAG?
($t->string =~ /^<a\b/is? '<a>':
$t->string =~ /^<input\b/is? '<input>':
$t->string =~ /^<input\b/is? (
lc $t->attributes->{'type'}->[1] eq 'text' ? '%S':
'%p'):
_quote_cformat($t->string)):
_quote_cformat($t->string);
}
@ -540,30 +542,63 @@ sub _optimize {
for (my $i = $#structure; $i >= 0; $i -= 1) {
last if $structure[$i]->type != TmplTokenType::TEXT;
last if !blank_p($structure[$i]->string);
push @{$this->{_queue}}, pop @structure;
# Queue element structure: [reanalysis-p, token]
push @{$this->{_queue}}, [1, pop @structure];
}
};
&$undo_trailing_blanks;
# FIXME: If the last token is a close tag but there are no tags
# FIXME: before it, drop the close tag back into the queue. This
# FIXME: is an ugly hack to get rid of "foo %s</h1>" type mess.
if (@structure >= 2
&& $structure[$#structure]->type == TmplTokenType::TAG
&& $structure[$#structure]->string =~ /^<\//s) {
my $has_other_tags_p = 0;
for (my $i = 0; $i < $#structure; $i += 1) {
$has_other_tags_p = 1 if $structure[$i]->type == TmplTokenType::TAG;
last if $has_other_tags_p;
while (@structure >= 2) {
my $something_done_p = 0;
# FIXME: If the last token is a close tag but there are no tags
# FIXME: before it, drop the close tag back into the queue. This
# FIXME: is an ugly hack to get rid of "foo %s</h1>" type mess.
if (@structure >= 2
&& $structure[$#structure]->type == TmplTokenType::TAG
&& $structure[$#structure]->string =~ /^<\//s) {
my $has_other_tags_p = 0;
for (my $i = 0; $i < $#structure; $i += 1) {
$has_other_tags_p = 1
if $structure[$i]->type == TmplTokenType::TAG;
last if $has_other_tags_p;
}
if (!$has_other_tags_p) {
push @{$this->{_queue}}, [0, pop @structure]
&$undo_trailing_blanks;
$something_done_p = 1;
}
}
push @{$this->{_queue}}, pop @structure unless $has_other_tags_p;
&$undo_trailing_blanks;
}
# FIXME: Do the same ugly hack for the last token being a ( or [
if (@structure >= 2
&& $structure[$#structure]->type == TmplTokenType::TEXT
&& $structure[$#structure]->string =~ /^[\(\[]$/) { # not )]
push @{$this->{_queue}}, pop @structure;
&$undo_trailing_blanks;
# FIXME: Do the same ugly hack for the last token being a ( or [
if (@structure >= 2
&& $structure[$#structure]->type == TmplTokenType::TEXT
&& $structure[$#structure]->string =~ /^[\(\[]$/) { # not )]
push @{$this->{_queue}}, [1, pop @structure];
&$undo_trailing_blanks;
$something_done_p = 1;
}
# FIXME: If the first token is an open tag, the last token is the
# FIXME: corresponding close tag, and there are no other close tags
# FIXME: inbetween, requeue the tokens from the second token on,
# FIXME: flagged as ok for re-analysis
if (@structure >= 3
&& $structure[0]->type == TmplTokenType::TAG
&& $structure[0]->string =~ /^<([a-z0-9])/is && (my $tag = $1)
&& $structure[$#structure]->type == TmplTokenType::TAG
&& $structure[$#structure]->string =~ /^<\/$1\s*>$/is) {
my $has_other_open_or_close_tags_p = 0;
for (my $i = 1; $i < $#structure; $i += 1) {
$has_other_open_or_close_tags_p = 1
if $structure[$i]->type == TmplTokenType::TAG
&& $structure[$i]->string =~ /^<\/?$tag\b/is;
last if $has_other_open_or_close_tags_p;
}
if (!$has_other_open_or_close_tags_p) {
for (my $i = $#structure; $i; $i -= 1) {
push @{$this->{_queue}}, [1, pop @structure];
}
$something_done_p = 1;
}
}
last if !$something_done_p;
}
return @structure;
}
@ -600,12 +635,16 @@ sub next_token {
my $it;
$this->{_queue} = [] unless defined $this->{_queue};
# Don't reparse anything in the queue. We can put a parametrized token
# there if we need to, however.
if (@{$this->{_queue}}) {
$it = pop @{$this->{_queue}};
# Elements in the queue are ordered pairs. The first in the ordered pair
# specifies whether we are allowed to reanalysis; the second is the token.
if (@{$this->{_queue}} && !$this->{_queue}->[$#{$this->{_queue}}]->[0]) {
$it = (pop @{$this->{_queue}})->[1];
} else {
$it = $this->_next_token_intermediate($h);
if (@{$this->{_queue}}) {
$it = (pop @{$this->{_queue}})->[1];
} else {
$it = $this->_next_token_intermediate($h);
}
if (!$this->cdata_mode_p && $this->allow_cformat_p && defined $it
&& ($it->type == TmplTokenType::TEXT?
!blank_p( $it->string ): _token_groupable1_p( $it ))) {
@ -624,7 +663,11 @@ sub next_token {
}
# We hate | and || in msgid strings, so we try to avoid them
for (my $i = 1, my $quit_p = 0, my $quit_next_p = ($it->type == TmplTokenType::TEXT && $it->string =~ /^\|+$/s);; $i += 1) {
$next = $this->_next_token_intermediate($h);
if (@{$this->{_queue}}) {
$next = (pop @{$this->{_queue}})->[1];
} else {
$next = $this->_next_token_intermediate($h);
}
push @structure, $next; # for consistency (with initialization)
last unless defined $next && _token_groupable2_p( $next );
last if $quit_next_p;
@ -635,7 +678,9 @@ sub next_token {
$parametrized_p = 1;
} elsif ($next->type == TmplTokenType::TAG) {
if ($next->string =~ /^<([A-Z0-9]+)/is) {
push @tags, lc($1);
my $candidate = lc($1);
push @tags, $candidate
unless $candidate =~ /^(?:input)$/is;
$with_anchor_p = 1 if lc($1) eq 'a';
$with_input_p = 1 if lc($1) eq 'input';
} elsif ($next->string =~ /^<\/([A-Z0-9]+)/is) {
@ -647,8 +692,8 @@ sub next_token {
}
last if $quit_p;
}
# Undo the last token
push @{$this->{_queue}}, pop @structure;
# Undo the last token, allowing reanalysis
push @{$this->{_queue}}, [1, pop @structure];
# Simply it a bit more
@structure = $this->_optimize( @structure );
if (@structure < 2) {
@ -673,12 +718,12 @@ sub next_token {
$it = TmplToken->new($string, TmplTokenType::TEXT,
$it->line_number, $it->pathname);;
} else {
# Requeue the tokens thus seen for re-emitting
# Requeue the tokens thus seen for re-emitting, allow reanalysis
for (;;) {
push @{$this->{_queue}}, pop @structure;
push @{$this->{_queue}}, [1, pop @structure];
last if !@structure;
}
$it = pop @{$this->{_queue}};
$it = (pop @{$this->{_queue}})->[1];
}
}
}
@ -717,39 +762,77 @@ sub quote_po ($) {
}
# Some functions that shouldn't be here... should be moved out some time
sub parametrize ($$$) {
my($fmt_0, $params, $anchors) = @_;
sub parametrize ($$$$) {
my($fmt_0, $cformat_p, $t, $f) = @_;
my $it = '';
for (my $n = 0, my $fmt = $fmt_0; length $fmt;) {
if ($fmt =~ /^[^%]+/) {
$fmt = $';
$it .= $&;
} elsif ($fmt =~ /^%%/) {
$fmt = $';
$it .= '%';
} elsif ($fmt =~ /^%(?:(\d+)\$)?(?:(\d+)(?:\.(\d+))?)?s/) {
$n += 1;
my($i, $width, $prec) = ((defined $1? $1: $n), $2, $3);
$fmt = $';
if (!defined $width && !defined $prec) {
my $param = $params->[$i - 1];
$it .= $param;
warn_normal "$&: Undefined parameter $i for msgid \"$fmt_0\"",
undef
unless defined $param;
} elsif (defined $width && defined $prec && !$width && !$prec) {
;
if ($cformat_p) {
my @params = $t->parameters_and_fields;
for (my $n = 0, my $fmt = $fmt_0; length $fmt;) {
if ($fmt =~ /^[^%]+/) {
$fmt = $';
$it .= $&;
} elsif ($fmt =~ /^%%/) {
$fmt = $';
$it .= '%';
} elsif ($fmt =~ /^%(?:(\d+)\$)?(?:(\d+)(?:\.(\d+))?)?s/s) {
$n += 1;
my($i, $width, $prec) = ((defined $1? $1: $n), $2, $3);
$fmt = $';
if (defined $width && defined $prec && !$width && !$prec) {
;
} elsif (defined $params[$i - 1]) {
my $param = $params[$i - 1];
warn_normal "$fmt_0: $&: Expected a TMPL_VAR, but found a "
. $param->type->to_string . "\n", undef
if $param->type != TmplTokenType::DIRECTIVE;
warn_normal "$fmt_0: $&: Unsupported "
. "field width or precision\n", undef
if defined $width || defined $prec;
warn_normal "$fmt_0: $&: Parameter $i not known", undef
unless defined $param;
$it .= defined $f? &$f( $param ): $param->string;
}
} elsif ($fmt =~ /^%(?:(\d+)\$)?(?:(\d+)(?:\.(\d+))?)?([pS])/s) {
$n += 1;
my($i, $width, $prec, $conv) = ((defined $1? $1: $n), $2, $3, $4);
$fmt = $';
my $param = $params[$i - 1];
if (!defined $param) {
warn_normal "$fmt_0: $&: Parameter $i not known", undef;
} else {
if ($param->type == TmplTokenType::TAG
&& $param->string =~ /^<input\b/is) {
my $type = defined $param->attributes?
lc($param->attributes->{'type'}->[1]): undef;
if ($conv eq 'S') {
warn_normal "$fmt_0: $&: Expected type=text, "
. "but found type=$type", undef
unless $type eq 'text';
} elsif ($conv eq 'p') {
warn_normal "$fmt_0: $&: Expected type=radio, "
. "but found type=$type", undef
unless $type eq 'radio';
}
} else {
warn_normal "$&: Expected an INPUT, but found a "
. $param->type->to_string . "\n", undef
}
warn_normal "$fmt_0: $&: Unsupported "
. "field width or precision\n", undef
if defined $width || defined $prec;
$it .= defined $f? &$f( $param ): $param->string;
}
} elsif ($fmt =~ /^%[^%a-zA-Z]*[a-zA-Z]/) {
$fmt = $';
$it .= $&;
die "$&: Unknown or unsupported format specification\n"; #XXX
} else {
die "Unsupported precision specification in format: $&\n"; #XXX
die "$&: Completely confused parametrizing\n";#XXX
}
} elsif ($fmt =~ /^%[^%a-zA-Z]*[a-zA-Z]/) {
$fmt = $';
$it .= $&;
die "Unknown or unsupported format specification: $&\n"; #XXX
} else {
die "Completely confused parametrizing: $fmt\n";#XXX
}
}
my @anchors = $t->anchors;
for (my $n = 0, my $fmt = $it, $it = ''; length $fmt;) {
if ($fmt =~ /^(?:(?!<a\d+>).)+/is) {
$fmt = $';
@ -758,7 +841,7 @@ sub parametrize ($$$) {
$n += 1;
my $i = $1;
$fmt = $';
my $anchor = $anchors->[$i - 1];
my $anchor = $anchors[$i - 1];
warn_normal "$&: Anchor $1 not found for msgid \"$fmt_0\"", undef #FIXME
unless defined $anchor;
$it .= $anchor->string;
@ -860,10 +943,60 @@ words will require certain inflectional suffixes in sentences.
Because this is an incompatible change, this mode must be explicitly
turned on using the set_cformat(1) method call.
=head2 The flag characters
The character % is followed by zero or more of the following flags:
=over
=item #
The value comes from HTML <INPUT> elements.
This abuse of the flag character is somewhat reasonable,
since TMPL_VAR and INPUT are both variables, but of different kinds.
=back
=head2 The field width and precision
An optional 0.0 can be specified for %s to specify
that the <TMPL_VAR> should be suppressed.
=head2 The conversion specifier
=over
=item p
Specifies any input field that is neither text nor hidden
(which currently mean radio buttons).
The p conversion specifier is chosen because this does not
evoke any certain sensible data type.
=item S
Specifies a text input field (<INPUT TYPE=TEXT>).
This use of the o conversion specifier is somewhat reasonable,
since text input fields contain values of undeterminable type,
which can be treated as strings.
=item s
Specifies a <TMPL_VAR>.
This use of the o conversion specifier is somewhat reasonable,
since <TMPL_VAR> denotes values of undeterminable type, which
can be treated as strings.
=back
=head1 BUGS
There is no code to save the tag name anywhere in the scanned token.
The use of <AI<i>> to stand for the I<i>th anchor
is not very well thought out.
Some abuse of c-format specifies might have been more appropriate.
=head1 HISTORY
This tokenizer is mostly based

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Koha OPAC 2.0.0RC4\n"
"POT-Creation-Date: 2004-02-26 00:13-0500\n"
"POT-Creation-Date: 2004-02-27 02:49-0500\n"
"PO-Revision-Date: 2004-02-18 02:40-0500\n"
"Last-Translator: Ambrose Li <acli@ada.dhs.org>\n"
"Language-Team: Chinese <zh@li.org>\n"
@ -14,41 +14,63 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. %1$p: type=radio name=ttype value=normal
#. %2$p: type=radio name=ttype value=exact
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:27
#, c-format
msgid "%pNormal%pExact"
msgstr "%p一般%p完全吻合"
#. %1$s: TMPL_VAR name=firstname
#. %2$s: TMPL_VAR name=surname
#. %3$s: TMPL_VAR name=title
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:11
#, c-format
msgid "%s %s (%s)"
msgstr ""
msgstr "%s %s (%s)"
#. %1$s: TMPL_VAR name=phone
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:13
#, c-format
msgid "%s (hm)"
msgstr "%s (住宅)"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=faxnumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:14
#, c-format
msgid "%s (wk)"
msgstr "%s (辦公室)"
# NOTE This refers to new books acquired in the last so-and-so days
# NOTE This is essentially the same string as the next, but different
# NOTE due to technical difficulties (in creating an msgid from the HTML)
# FIXME This string as it is is nearly untranslatable. The scanner need to be fixed.
#. %1$s: TMPL_VAR name=CGIitemtype
#. %2$S: type=text name=duration
#: ../../koha-tmpl/opac-tmpl/default/en/opac-main.tmpl:105
#, c-format
msgid "%s <b>acquired in the last"
msgstr "最近新到的 %s 圖書資料:最近"
msgid "%s <b>acquired in the last %S days</b>"
msgstr "<b>最近%2$S日內新到的</b>%1$s"
#. %1$s: TMPL_VAR name=biblioitemnumber
#. %2$s: TMPL_VAR name=description
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:20
#, c-format
msgid "%s GROUP - %s"
msgstr "%s 群組 - %s"
#. %1$s: TMPL_VAR name=itemtype
#. %2$s: TMPL_VAR name=duration
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:9
#, c-format
msgid "%s acquired in the last <i>%s</i> days"
msgstr "最近<b>%2$s</b>日內新到的%1$s圖書資料"
msgstr "最近<b>%2$s</b>日內新到的%1$s"
#. %1$s: TMPL_VAR name=numrecords
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:15
#, c-format
msgid "%s results found"
msgstr "找到%s個結果"
#. %1$s: TMPL_VAR name=streetaddress
#. %2$s: TMPL_VAR name=city
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:12
#, c-format
msgid "%s, %s"
@ -58,160 +80,188 @@ msgstr "%s, %s"
msgid "&copy;"
msgstr "&copy;"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:20
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:46
#, c-format
msgid "<B>%s GROUP - %s </b>"
msgstr "<b>%s 群組 - %s</b>"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:56
#, c-format
msgid "<B>BARCODE %s</b>"
msgstr "<B>條碼 %s</b>"
msgid "<a1>Log In</a> to Koha"
msgstr "<a1>登入</a>Koha"
#. %1$s: TMPL_VAR name=title
#. %2$s: TMPL_VAR name=biblionumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:15
#, c-format
msgid "<b>%s</b> ( record %s )"
msgstr "<b>%s</b> (書目記錄號碼 %s)"
#. %1$s: TMPL_VAR name=dateaccessioned
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:83
#, c-format
msgid "<b><a1> Accession</a> Date:%s"
msgstr "<b><a1>登錄</a>日期:%s"
#. %1$s: TMPL_VAR name=issues
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:87
#, c-format
msgid "<b><a1>Total Issues:</a></b> %s"
msgstr "<b><a1>借書次數:</a></b> %s"
#. %1$s: TMPL_VAR name=additional
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:24
#, c-format
msgid "<b>Additional Author:</b>%s"
msgstr "<b>附加著者:</b>%s"
#. %1$s: TMPL_VAR name=author
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:23
#, c-format
msgid "<b>Author:</b> <a1>%s</a>"
msgstr "<b>著者:</b><a1>%s</a>"
#. %1$s: TMPL_VAR name=biblionumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:91
#, c-format
msgid "<b>Biblio number:</b> %s"
msgstr "<b>書目記錄號碼:</b>%s"
#. %1$s: TMPL_VAR name=biblionumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:30
#, c-format
msgid "<b>Biblionumber:</b> %s"
msgstr "<b>書目記錄號碼:</b>%s"
#. %1$s: TMPL_VAR name=wthdrawn
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:86
#, c-format
msgid "<b>Cancelled: %s"
msgstr "<b>已註消:</b>%s"
#. %1$s: TMPL_VAR name=classification
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:36
#, c-format
msgid "<b>Classification:</b> %s"
msgstr "<b>分類:</b>%s"
#. %1$s: TMPL_VAR name=classification
#. %2$s: TMPL_VAR name=dewey
#. %3$s: TMPL_VAR name=subclass
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:35
#, c-format
msgid "<b>Classification:</b> %s%s%s"
msgstr "<b>分類:</b>%s%s%s"
#. %1$s: TMPL_VAR name=seriestitle
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:29
#, c-format
msgid "<b>Collection:</b> %s"
msgstr "<b>館藏:</b>%s"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=holdingbranch
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:77
#, c-format
msgid "<b>Current Branch:</b> %s"
msgstr "<b>目前分館:</b>%s"
#. %1$s: TMPL_VAR name=publicationyear
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:39
#, c-format
msgid "<b>Date:</b> %s"
msgstr "<b>日期:</b>%s"
#. %1$s: TMPL_VAR name=dewey
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:35
#, c-format
msgid "<b>Dewey:</b> <a1>%s</a>"
msgstr "<b>杜威分類號:</b><a1>%s</a>"
#. %1$s: TMPL_VAR name=biblioitemnumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:90
#, c-format
msgid "<b>Group Number:</b> %s"
msgstr "<b>群組號碼:</b>%s"
# XXX tentative
#. %1$s: TMPL_VAR name=homebranch
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:71
#, c-format
msgid "<b>Home Branch:</b> %s"
msgstr "<b>您的分館:</b>%s"
#. %1$s: TMPL_VAR name=isbn
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:36
#, c-format
msgid "<b>ISBN:</b> %s"
msgstr "<b>國際標準書號:</b>%s"
#. %1$s: TMPL_VAR name=ISBN
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:21
#, c-format
msgid "<b>ISBN:</b><a1>%s</a>"
msgstr "<b>國際標準書號:</b><a1>%s</a>"
#. %1$s: TMPL_VAR name=illus
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:42
#, c-format
msgid "<b>Illus:</b> %s"
msgstr "<b>繪圖:</b>%s"
#. %1$s: TMPL_VAR name=itemtype
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:31
#, c-format
msgid "<b>Item Type:</b> %s"
msgstr "<b>圖書資料類別:</b>%s"
#. %1$s: TMPL_VAR name=itemlost
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:79
#, c-format
msgid "<b>Item lost:</b> %s"
msgstr "<b>遺失圖書資料:</b>%s"
#. %1$s: TMPL_VAR name=lccn
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:37
#, c-format
msgid "<b>LCCN:</b> %s"
msgstr "<b>LCCN</b>%s"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=card0
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:75
#, c-format
msgid "<b>Last Borrower 1:</b> %s"
msgstr "<b>最近借閱者1</b>%s"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=card1
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:76
#, c-format
msgid "<b>Last Borrower 2:</b> %s"
msgstr "<b>最近借閱者2</b>%s"
#. %1$s: TMPL_VAR name=timestamp0
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:73
#, c-format
msgid "<b>Last borrowed:</b> %s"
msgstr "<b>最近借出:</b>%s"
#. %1$s: TMPL_VAR name=datelastseen
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:72
#, c-format
msgid "<b>Last seen:</b> %s"
msgstr "<b>最近出現:</b>%s"
#. %1$s: TMPL_VAR name=loanlength
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:33
#, c-format
msgid "<b>Loan Length:</b> %s"
msgstr "<b>借閱期限:</b>%s"
#. %1$s: TMPL_VAR name=count
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:45
#, c-format
msgid "<b>No. of Items:</b> %s"
msgstr "<b>數量:</b>%s"
#. For the first occurrence,
#. %1$s: TMPL_VAR name=notes
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:32
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:44
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:81
@ -219,6 +269,7 @@ msgstr "<b>數量:</b>%s"
msgid "<b>Notes:</b> %s"
msgstr "<b>備註:</b>%s"
#. %1$s: TMPL_VAR name=pages
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:41
#, c-format
msgid "<b>Pages:</b> %s"
@ -227,113 +278,124 @@ msgstr "<b>頁數:</b>%s"
# NOTE The meaning of this mysterious string can only be known if you read C4/Accounts2.pm
# NOTE in sub returnlost (and/or read <URL:http://www.koha.org/download/files/ChangeLog>).
# NOTE This is a "theoretically free form" field storing strings like "Paid for by $bor $date"
#. %1$s: TMPL_VAR name=paidfor
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:80
#, c-format
msgid "<b>Paid for:</b> %s"
msgstr "<b>賠償:</b>%s"
#. %1$s: TMPL_VAR name=place
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:38
#, c-format
msgid "<b>Place:</b> %s"
msgstr "<b>出版地:</b>%s"
#. %1$s: TMPL_VAR name=publishercode
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:25
#, c-format
msgid "<b>Published by :</b>%s"
msgstr "<b>出版者:</b>%s"
#. %1$s: TMPL_VAR name=publishercode
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:37
#, c-format
msgid "<b>Publisher:</b> %s"
msgstr "<b>出版者:</b>%s"
#. %1$s: TMPL_VAR name=renewals
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:82
#, c-format
msgid "<b>Renewals:</b> %s"
msgstr "<b>續借次數:</b>%s"
#. %1$s: TMPL_VAR name=rentalcharge
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:34
#, c-format
msgid "<b>Rental Charge:</b> %s"
msgstr "<b>借書費用:</b>%s"
#. %1$s: TMPL_VAR name=replacementprice
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:78
#, c-format
msgid "<b>Replacement Price:</b> %s"
msgstr "<b>書價:</b>%s"
#. %1$s: TMPL_VAR name=serial
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:34
#, c-format
msgid "<b>Serial:</b>%s"
msgstr "<b>期刊:</b>%s"
#. %1$s: TMPL_VAR name=size
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:43
#, c-format
msgid "<b>Size:</b> %s"
msgstr "<b>大小:</b>%s"
#. %1$s: TMPL_VAR name=subject
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:30
#, c-format
msgid "<b>Subject:</b> %s"
msgstr "<b>主題:</b>%s"
#. %1$s: TMPL_VAR name=subtitle
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:22
#, c-format
msgid "<b>Subtitle:</b>%s"
msgstr "<b>副題:</b>%s"
#. %1$s: TMPL_VAR name=count
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:39
#, c-format
msgid "<b>Total Number of Items:</b> %s"
msgstr "<b>項目總數:</b>%s"
#. %1$s: TMPL_VAR name=url
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:32
#, c-format
msgid "<b>URL:</b> %s"
msgstr "<b>網址:</b>%s"
#. %1$s: TMPL_VAR name=url
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:38
#, c-format
msgid "<b>URL:</b> <a1>%s</a>"
msgstr "<b>網址:</b><a1>%s</a>"
#. %1$s: TMPL_VAR name=unititle
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:33
#, c-format
msgid "<b>Unititle:</b> %s"
msgstr "<b>劃一題名:</b>%s"
#. %1$s: TMPL_VAR name=volumeddesc
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:40
#, c-format
msgid "<b>Volume:</b> %s"
msgstr "<b>集叢號:</b>%s"
#. %1$s: TMPL_VAR name=copyrightdate
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:31
#, c-format
msgid "<b>Year :</b> %s"
msgstr "<b>年份:</b>%s"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:51
#, c-format
msgid "<b>You have a credit of %s</b>"
msgstr "<b>您有 %s 結餘</b>"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:28
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:39
#, c-format
msgid "<b>You have outstanding charges and fines of %s</b>"
msgstr "<b>您尚欠罰款或其他費用%s</b>"
# XXX This (in the English template) is problematic
#. %1$s: TMPL_VAR name=publicationyear
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:26
#, c-format
msgid "<b>in </b>%s"
msgstr " <b>於</b>%s"
#. %1$s: TMPL_VAR name=title
#. %2$s: TMPL_VAR name=author
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:9
#, c-format
msgid "<em><a1>%s (%s)</a></em>"
msgstr "<em><a1>%s (%s)</a></em>"
#. %1$s: TMPL_VAR name=firstname
#. %2$s: TMPL_VAR name=surname
#: ../../koha-tmpl/opac-tmpl/default/en/opac-account.tmpl:4
#, c-format
msgid "<em>Account for %s %s</em>"
@ -384,6 +446,12 @@ msgstr "著者"
msgid "Available"
msgstr "在館內"
#. %1$s: TMPL_VAR name=barcode
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:56
#, c-format
msgid "BARCODE %s"
msgstr "條碼 %s"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-detail.tmpl:51
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:53
msgid "Barcode"
@ -414,6 +482,7 @@ msgstr "市"
msgid "Class"
msgstr "類別"
#. INPUT type=reset
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:59
msgid "Clear All Fields"
msgstr "全部清空"
@ -467,12 +536,6 @@ msgstr "電郵"
msgid "End reserve on this date:"
msgstr "在此日期停止預約:"
# TODO:舊譯「這是整個書名」
# NOTE 譯文更動 by Arthur
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:27
msgid "Exact"
msgstr "完全吻合"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-account.tmpl:9
msgid "FINES &amp; CHARGES"
msgstr "罰款及費用"
@ -526,6 +589,7 @@ msgstr "一月"
msgid "Join"
msgstr "讀者登記"
#. A
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:28
msgid "Join the library"
msgstr "辦理讀者登記手續"
@ -560,7 +624,7 @@ msgstr "KOHA查詢館藏"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:8
msgid "Keywords"
msgstr "關鍵"
msgstr "關鍵"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-auth.tmpl:32
msgid "Koha Login"
@ -570,6 +634,7 @@ msgstr "登入Koha"
msgid "Last Seen"
msgstr "最近出現"
#. %1$s: TMPL_VAR name=cardnumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:10
#, c-format
msgid "Library Card: %s"
@ -581,8 +646,8 @@ msgstr "借書證:%s"
msgid "Location"
msgstr "地點"
#. INPUT type=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-auth.tmpl:35
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:46
msgid "Log In"
msgstr "登入"
@ -590,6 +655,8 @@ msgstr "登入"
msgid "Log In to Koha"
msgstr "登入Koha"
#. For the first occurrence,
#. %1$s: TMPL_VAR name=loggedinuser
#: ../../koha-tmpl/opac-tmpl/default/en/opac-main.tmpl:117
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:44
#, c-format
@ -611,6 +678,8 @@ msgstr "五月"
msgid "Month"
msgstr "月"
#. For the first occurrence,
#. IMG
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:33
#: ../../koha-tmpl/opac-tmpl/default/en/subject.tmpl:30
msgid "Next Page"
@ -629,11 +698,6 @@ msgstr "否"
msgid "Non-Fiction"
msgstr "非小說"
# TODO 舊譯「書名中有這些字眼即可」
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:27
msgid "Normal"
msgstr "一般"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:89
msgid "Not Reservable"
msgstr "不可預約"
@ -643,9 +707,10 @@ msgid ""
"Note that if you enter a value in Keyword and a value somewhere else, only "
"keyword will be used"
msgstr ""
"注意:一旦輸入了「關鍵」,即使在其他欄位輸入了其他查詢條件,也只會使用關鍵"
"注意:一旦輸入了「關鍵」,即使在其他欄位輸入了其他查詢條件,也只會使用關鍵"
"字。"
#. %1$s: TMPL_VAR name=fee
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:105
#, c-format
msgid "Note there will be a reserve charge of <b>$%s</b>"
@ -656,10 +721,12 @@ msgstr "注意:預約須繳交手續費<b>$%s</b>"
msgid "Nov"
msgstr "十一月"
#. INPUT type=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-main.tmpl:106
msgid "OK"
msgstr "好!"
#. INPUT type=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-search.tmpl:58
msgid "OK Start Search"
msgstr "開始查詢"
@ -694,6 +761,7 @@ msgstr "密碼:"
msgid "Pick Up Branch"
msgstr "取書分館"
#. INPUT type=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:107
msgid "Place Reserve"
msgstr "預約"
@ -707,6 +775,7 @@ msgid "Please confirm that you wish to request an item of these types:"
msgstr "請確定您要預約下列種類的圖書資料:"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=CGIbranch
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:44
#, c-format
msgid "Please select the branch from which you want to collect the item: %s"
@ -720,6 +789,8 @@ msgstr ""
"請您選擇有那幾類的圖書資料適合您。一有同類的圖書資料可借,該項圖書資料會隨即"
"預留給您。"
#. For the first occurrence,
#. IMG
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:21
#: ../../koha-tmpl/opac-tmpl/default/en/subject.tmpl:18
msgid "Previous Page"
@ -753,18 +824,27 @@ msgstr "預約日期"
msgid "Reserve on this date:"
msgstr "由這日開始預約:"
#. %1$s: TMPL_VAR name=title
#. %2$s: TMPL_VAR name=author
#. %3$s: TMPL_VAR name=biblionumber
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:18
#, c-format
msgid "Reserve page for item: <b>%s (%s %s)</b>"
msgstr "圖書資料《<b>%s (%s %s)</b>》之預約頁"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=startfrom
#. %2$s: TMPL_VAR name=endat
#. %3$s: TMPL_VAR name=numrecords
#: ../../koha-tmpl/opac-tmpl/default/en/subject.tmpl:15
#, c-format
msgid "Results %s through %s of %s records."
msgstr "共%3$s項結果中的第%1$s至%2$s項結果"
# NOTE 譯文更動 by Arthur
#. %1$s: TMPL_VAR name=startfrom
#. %2$s: TMPL_VAR name=endat
#. %3$s: TMPL_VAR name=numrecords
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:122
#, c-format
msgid "Results <i>%s</i> through <i>%s</i> of <i>%s</i> records."
@ -801,11 +881,13 @@ msgstr "對不起KOHA認為你沒有權限來這一頁。"
msgid "Sorry, there were no results"
msgstr "對不起,什麼也找不到"
#. %1$s: TMPL_VAR name=too_many_reserves
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:10
#, c-format
msgid "Sorry, you cannot make more than %s reserves."
msgstr "對不起,您不可預約超過%s項資料。"
#. %1$s: TMPL_VAR name=too_much_oweing
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:9
#, c-format
msgid "Sorry, you cannot make reserves because you owe %s."
@ -827,6 +909,8 @@ msgid "Subject"
msgstr "主題"
# FIXME 譯文更動 by Arthur
#. For the first occurrence,
#. INPUT type=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:79
#: ../../koha-tmpl/opac-tmpl/default/en/opac-userupdate.tmpl:39
msgid "Submit"
@ -840,6 +924,7 @@ msgstr "姓"
msgid "Teacher Reference"
msgstr "教師參考書"
#. %1$s: TMPL_VAR name=reservecount
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:19
#, c-format
msgid "There are <b>%s</b> reserves already on this item."
@ -884,6 +969,7 @@ msgstr "KOHA線上目錄歡迎您"
msgid "Website"
msgstr "網站"
#. %1$s: TMPL_VAR name=branchname
#: ../../koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl:102
#, c-format
msgid "Which is to be picked up from <b>%s</b>."
@ -920,20 +1006,36 @@ msgstr "您沒有指定任何查詢條件。"
msgid "You entered an incorrect username or password, please try again."
msgstr "您輸入錯了使用者名稱或密碼,請重試。"
#. %1$s: TMPL_VAR name=issues_count
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:90
#, c-format
msgid "You have %s items currently issued."
msgstr "您目前借了 %s 項圖書資料。"
#. %1$s: TMPL_VAR name=reserves_count
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:117
#, c-format
msgid "You have %s items currently reserved."
msgstr "您目前預約了 %s 項圖書資料。"
#. %1$s: TMPL_VAR name=amountoutstanding
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:51
#, c-format
msgid "You have a credit of %s"
msgstr "您有 %s 結餘"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:112
msgid "You have no items on issue."
msgstr "您沒有借出任何圖書資料。"
#. For the first occurrence,
#. %1$s: TMPL_VAR name=amountoutstanding
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:28
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:39
#, c-format
msgid "You have outstanding charges and fines of %s"
msgstr "您尚欠款項 %s"
# FIXME 譯文更動 by Arthur
#: ../../koha-tmpl/opac-tmpl/default/en/opac-user.tmpl:66
msgid "You have reserved items waiting:"
@ -947,6 +1049,7 @@ msgstr "您一定要撰擇在哪間分館取書!"
msgid "You must select at least one item type!"
msgstr "您一定要撰擇至少一種圖書資料的類別!"
#. %1$s: TMPL_VAR name=searchdesc
#: ../../koha-tmpl/opac-tmpl/default/en/opac-searchresults.tmpl:6
#, c-format
msgid "You searched on <b>%s</b>"
@ -960,19 +1063,20 @@ msgstr "青年小說類"
msgid "Your changes won't appear until the library has validated them."
msgstr "圖書館核實您的作的修改後,修改才會生效。"
#: ../../koha-tmpl/opac-tmpl/default/en/opac-main.tmpl:105
msgid "days"
msgstr "日"
#. For the first occurrence,
#. INPUT type=image name=delete
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:27
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:68
msgid "delete"
msgstr "移除"
#. A
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:33
msgid "home page"
msgstr "返回首頁"
#. For the first occurrence,
#. INPUT type=image name=submit
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:25
#: ../../koha-tmpl/opac-tmpl/default/en/opac-moredetail.tmpl:66
msgid "modify"
@ -982,11 +1086,31 @@ msgstr "修改"
msgid "on issue bit"
msgstr "借出"
#. For the first occurrence,
#. META http-equiv=Content-Type
#: ../../koha-tmpl/opac-tmpl/default/en/opac-main.tmpl:4
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:6
msgid "text/html; charset=iso-8859-1"
msgstr "text/html; charset=UTF-8"
#: ../../koha-tmpl/opac-tmpl/default/en/includes/opac-top.inc:46
msgid "to Koha"
msgstr "Koha"
# NOTE This refers to new books acquired in the last so-and-so days
# NOTE This is essentially the same string as the next, but different
# NOTE due to technical difficulties (in creating an msgid from the HTML)
# FIXME This string as it is is nearly untranslatable. The scanner need to be fixed.
#~ msgid "%s <b>acquired in the last"
#~ msgstr "最近新到的 %s 圖書資料:最近"
# TODO:舊譯「這是整個書名」
# NOTE 譯文更動 by Arthur
#~ msgid "Exact"
#~ msgstr "完全吻合"
# TODO 舊譯「書名中有這些字眼即可」
#~ msgid "Normal"
#~ msgstr "一般"
#~ msgid "days"
#~ msgstr "日"
#~ msgid "to Koha"
#~ msgstr "Koha"

View file

@ -90,10 +90,11 @@ sub text_replace (**) {
print $output find_translation($t);
} elsif ($kind eq TmplTokenType::TEXT_PARAMETRIZED) {
my $fmt = find_translation($s->form);
print $output TmplTokenizer::parametrize($fmt, [ map {
print $output TmplTokenizer::parametrize($fmt, 1, $s, sub {
$_ = $_[0];
my($kind, $t, $attr) = ($_->type, $_->string, $_->attributes);
$kind == TmplTokenType::TAG && %$attr?
text_replace_tag($t, $attr): $t } $s->parameters ], [ $s->anchors ]);
text_replace_tag($t, $attr): $t });
} elsif ($kind eq TmplTokenType::TAG && %$attr) {
print $output text_replace_tag($t, $attr);
} elsif (defined $t) {

View file

@ -19,6 +19,7 @@ use vars qw( $extract_all_p );
use vars qw( $pedantic_p );
use vars qw( %text %translation );
use vars qw( $charset_in $charset_out );
use vars qw( $disable_fuzzy_p );
use vars qw( $verbose_p );
use vars qw( $po_mode_p );
@ -115,7 +116,7 @@ sub text_extract (*) {
sub generate_strings_list () {
# Emit all extracted strings.
for my $t (string_list) {
printf OUTPUT "%s\n", $t # unless negligible_p($t);
printf OUTPUT "%s\n", $t;
}
}
@ -135,7 +136,11 @@ sub generate_po_file () {
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL\@ADDRESS>, YEAR.
#
EOF
print OUTPUT <<EOF unless $disable_fuzzy_p;
#, fuzzy
EOF
print OUTPUT <<EOF;
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\\n"
@ -150,7 +155,50 @@ msgstr ""
EOF
my $directory_re = quotemeta("$directory/");
for my $t (string_list) {
#next if negligible_p($t);
if ($text{$t}->[0]->type == TmplTokenType::TEXT_PARAMETRIZED) {
my($token, $n) = ($text{$t}->[0], 0);
printf OUTPUT "#. For the first occurrence,\n"
if @{$text{$t}} > 1 && $token->parameters_and_fields > 0;
for my $param ($token->parameters_and_fields) {
$n += 1;
my $type = $param->type;
my $subtype = ($type == TmplTokenType::TAG
&& $param->string =~ /^<input\b/is?
$param->attributes->{'type'}->[1]: undef);
my $fmt = TmplTokenizer::_formalize( $param );
$fmt =~ s/^%/%$n\$/;
if ($type == TmplTokenType::DIRECTIVE) {
$type = $param->string =~ /(TMPL_[A-Z]+)+/is? $1: 'ERROR';
my $name = $param->string =~ /\bname=(["']?)([^\s"']+)\1/is?
$2: undef;
printf OUTPUT "#. %s: %s\n", $fmt,
"$type" . (defined $name? " name=$name": '');
} else {
my $name = $param->attributes->{'name'};
my $value = $param->attributes->{'value'}
unless $subtype =~ /^(?:text)$/;
printf OUTPUT "#. %s: %s\n", $fmt, "type=$subtype"
. (defined $name? " name=$name->[1]": '')
. (defined $value? " value=$value->[1]": '');
}
}
} elsif ($text{$t}->[0]->type == TmplTokenType::TAG) {
my($token) = ($text{$t}->[0]);
printf OUTPUT "#. For the first occurrence,\n"
if @{$text{$t}} > 1 && $token->parameters_and_fields > 0;
if ($token->string =~ /^<meta\b/is) {
my $type = $token->attributes->{'http-equiv'}->[1];
print OUTPUT "#. META http-equiv=$type\n" if defined $type;
} elsif ($token->string =~ /^<([a-z0-9]+)/is) {
my $tag = uc($1);
my $type = (lc($tag) eq 'input'?
$token->attributes->{'type'}: undef);
my $name = $token->attributes->{'name'};
printf OUTPUT "#. %s\n", $tag
. (defined $type? " type=$type->[1]": '')
. (defined $name? " name=$name->[1]": '');
}
}
my $cformat_p;
for my $token (@{$text{$t}}) {
my $pathname = $token->pathname;
@ -258,6 +306,7 @@ GetOptions(
'charset=s' => sub { $charset_in = $charset_out = $_[1] }, # INTERNAL
'convert-from=s' => \$convert_from,
'D|directory=s' => \$directory,
'disable-fuzzy' => \$disable_fuzzy_p, # INTERNAL
'f|files-from=s' => \$files_from,
'I|input-charset=s' => \$charset_in, # INTERNAL
'pedantic-warnings|pedantic' => sub { $pedantic_p = 1 },
@ -360,9 +409,9 @@ details.
If you want to generate GNOME-style POTFILES.in files, such
files (passed to -f) can be generated thus:
(cd ../.. && find koha-tmpl/opac-tmpl/default/en
(cd ../.. && find koha-tmpl/opac-tmpl/default/en \
-name \*.inc -o -name \*.tmpl) > opac/POTFILES.in
(cd ../.. && find koha-tmpl/intranet-tmpl/default/en
(cd ../.. && find koha-tmpl/intranet-tmpl/default/en \
-name \*.inc -o -name \*.tmpl) > intranet/POTFILES.in
This is, however, quite pointless, because the "create" and