[Koha-cvs] CVS: koha/misc/translator TmplTokenizer.pm,1.17,1.18 intranet.zh_TW,1.4,1.5 xgettext.pl,1.2,1.3
Ambrose C. LI
acli at users.sourceforge.net
Sun Feb 22 07:46:26 CET 2004
Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13681
Modified Files:
TmplTokenizer.pm intranet.zh_TW xgettext.pl
Log Message:
Templates with French characters were not handled properly in the install
step. This is now fixed.
Index: TmplTokenizer.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/TmplTokenizer.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** TmplTokenizer.pm 22 Feb 2004 05:18:52 -0000 1.17
--- TmplTokenizer.pm 22 Feb 2004 06:46:15 -0000 1.18
***************
*** 536,540 ****
$s =~ s/([\\"])/\\\1/gs;
$s =~ s/\n/\\n/g;
! $s =~ s/[\177-\377]/ sprintf("\\%03o", ord($&)) /egs;
return "\"$s\"";
}
--- 536,540 ----
$s =~ s/([\\"])/\\\1/gs;
$s =~ s/\n/\\n/g;
! #$s =~ s/[\177-\377]/ sprintf("\\%03o", ord($&)) /egs;
return "\"$s\"";
}
***************
*** 581,584 ****
--- 581,621 ----
}
+ use vars qw( @latin1_utf8 );
+ @latin1_utf8 = (
+ "\302\200", "\302\201", "\302\202", "\302\203", "\302\204", "\302\205",
+ "\302\206", "\302\207", "\302\210", "\302\211", "\302\212", "\302\213",
+ "\302\214", "\302\215", undef, undef, "\302\220", "\302\221",
+ "\302\222", "\302\223", "\302\224", "\302\225", "\302\226", "\302\227",
+ "\302\230", "\302\231", "\302\232", "\302\233", "\302\234", "\302\235",
+ "\302\236", "\302\237", "\302\240", "\302\241", "\302\242", "\302\243",
+ "\302\244", "\302\245", "\302\246", "\302\247", "\302\250", "\302\251",
+ "\302\252", "\302\253", "\302\254", "\302\255", "\302\256", "\302\257",
+ "\302\260", "\302\261", "\302\262", "\302\263", "\302\264", "\302\265",
+ "\302\266", "\302\267", "\302\270", "\302\271", "\302\272", "\302\273",
+ "\302\274", "\302\275", "\302\276", "\302\277", "\303\200", "\303\201",
+ "\303\202", "\303\203", "\303\204", "\303\205", "\303\206", "\303\207",
+ "\303\210", "\303\211", "\303\212", "\303\213", "\303\214", "\303\215",
+ "\303\216", "\303\217", "\303\220", "\303\221", "\303\222", "\303\223",
+ "\303\224", "\303\225", "\303\226", "\303\227", "\303\230", "\303\231",
+ "\303\232", "\303\233", "\303\234", "\303\235", "\303\236", "\303\237",
+ "\303\240", "\303\241", "\303\242", "\303\243", "\303\244", "\303\245",
+ "\303\246", "\303\247", "\303\250", "\303\251", "\303\252", "\303\253",
+ "\303\254", "\303\255", "\303\256", "\303\257", "\303\260", "\303\261",
+ "\303\262", "\303\263", "\303\264", "\303\265", "\303\266", "\303\267",
+ "\303\270", "\303\271", "\303\272", "\303\273", "\303\274", "\303\275",
+ "\303\276", "\303\277" );
+
+ sub charset_convert ($$$) {
+ my($s, $charset_in, $charset_out) = @_;
+ if ($s !~ /[\200-\377]/s) { # FIXME: don't worry about iso2022 for now
+ ;
+ } elsif ($charset_in eq 'ISO-8859-1' && $charset_out eq 'UTF-8') {
+ $s =~ s/[\200-\377]/ $latin1_utf8[ord($&) - 128] /egs;
+ } elsif ($charset_in ne $charset_out) {
+ VerboseWarnings::warn_normal "conversion from $charset_in to $charset_out is not supported\n", undef;
+ }
+ return $s;
+ }
+
###############################################################################
Index: intranet.zh_TW
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/intranet.zh_TW,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** intranet.zh_TW 20 Feb 2004 09:32:14 -0000 1.4
--- intranet.zh_TW 22 Feb 2004 06:46:16 -0000 1.5
***************
*** 4,7 ****
--- 4,10 ----
# Copyright 2004 Ambrose Li
#
+ # FIXME words tentatively translated: active, illustration, illustrator, inactive
+ # FIXME "request", "reserve" should be é ç´ [http://www.tpml.edu.tw/chinese/service/service.htm]
+ #
msgid ""
msgstr ""
***************
*** 39,52 ****
[...3717 lines suppressed...]
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:43
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:44
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:45
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:46
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:47
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:48
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:49
- #: ../../koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl:50
- msgid "||"
- msgstr "||"
-
#: ../../koha-tmpl/intranet-tmpl/default/en/includes/acquisitions-bottom.inc:16
#: ../../koha-tmpl/intranet-tmpl/default/en/includes/cat-bottom.inc:16
--- 7096,7099 ----
***************
*** 7221,7222 ****
--- 7108,7110 ----
"Help"
msgstr ""
+
Index: xgettext.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/xgettext.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** xgettext.pl 22 Feb 2004 05:18:52 -0000 1.2
--- xgettext.pl 22 Feb 2004 06:46:17 -0000 1.3
***************
*** 15,18 ****
--- 15,19 ----
use vars qw( $convert_from );
use vars qw( $files_from $directory $output $sort );
+ use vars qw( $extract_all_p );
use vars qw( $pedantic_p );
use vars qw( %text %translation );
***************
*** 21,59 ****
###############################################################################
! use vars qw( @latin1_utf8 );
! @latin1_utf8 = (
! "\302\200", "\302\201", "\302\202", "\302\203", "\302\204", "\302\205",
! "\302\206", "\302\207", "\302\210", "\302\211", "\302\212", "\302\213",
! "\302\214", "\302\215", undef, undef, "\302\220", "\302\221",
! "\302\222", "\302\223", "\302\224", "\302\225", "\302\226", "\302\227",
! "\302\230", "\302\231", "\302\232", "\302\233", "\302\234", "\302\235",
! "\302\236", "\302\237", "\302\240", "\302\241", "\302\242", "\302\243",
! "\302\244", "\302\245", "\302\246", "\302\247", "\302\250", "\302\251",
! "\302\252", "\302\253", "\302\254", "\302\255", "\302\256", "\302\257",
! "\302\260", "\302\261", "\302\262", "\302\263", "\302\264", "\302\265",
! "\302\266", "\302\267", "\302\270", "\302\271", "\302\272", "\302\273",
! "\302\274", "\302\275", "\302\276", "\302\277", "\303\200", "\303\201",
! "\303\202", "\303\203", "\303\204", "\303\205", "\303\206", "\303\207",
! "\303\210", "\303\211", "\303\212", "\303\213", "\303\214", "\303\215",
! "\303\216", "\303\217", "\303\220", "\303\221", "\303\222", "\303\223",
! "\303\224", "\303\225", "\303\226", "\303\227", "\303\230", "\303\231",
! "\303\232", "\303\233", "\303\234", "\303\235", "\303\236", "\303\237",
! "\303\240", "\303\241", "\303\242", "\303\243", "\303\244", "\303\245",
! "\303\246", "\303\247", "\303\250", "\303\251", "\303\252", "\303\253",
! "\303\254", "\303\255", "\303\256", "\303\257", "\303\260", "\303\261",
! "\303\262", "\303\263", "\303\264", "\303\265", "\303\266", "\303\267",
! "\303\270", "\303\271", "\303\272", "\303\273", "\303\274", "\303\275",
! "\303\276", "\303\277" );
!
! sub charset_convert ($) {
! my($s) = @_;
! if ($s !~ /[\200-\377]/s) { # FIXME: don't worry about iso2022 for now
! ;
! } elsif ($charset_in eq 'ISO-8859-1' && $charset_out eq 'UTF-8') {
! $s =~ s/[\200-\377]/ $latin1_utf8[ord($&) - 128] /egs;
! } elsif ($charset_in ne $charset_out) {
! VerboseWarnings::warn_normal "conversion from $charset_in to $charset_out is not supported\n", undef;
! }
! return $s;
}
--- 22,37 ----
###############################################################################
! sub negligible_p ($) {
! my($t) = @_; # a string
! # Don't emit pure whitespace, pure numbers, pure punctuation,
! # single letters, or TMPL_VAR's.
! # Punctuation should arguably be translated. But without context
! # they are untranslatable.
! return !$extract_all_p && (
! TmplTokenizer::blank_p($t) # blank or TMPL_VAR
! || $t =~ /^\d+$/ # purely digits
! || $t =~ /^[-\.,:;'"%\(\)\[\]\|]+$/ # pure punctuation w/o context
! || $t =~ /^[A-Za-z]$/ # single letters
! );
}
***************
*** 118,125 ****
sub generate_strings_list () {
# Emit all extracted strings.
- # Don't emit pure whitespace, pure numbers, or TMPL_VAR's.
for my $t (string_list) {
! printf OUTPUT "%s\n", $t
! unless TmplTokenizer::blank_p($t) || $t =~ /^\d+$/;
}
}
--- 96,101 ----
sub generate_strings_list () {
# Emit all extracted strings.
for my $t (string_list) {
! printf OUTPUT "%s\n", $t unless negligible_p($t);
}
}
***************
*** 152,156 ****
my $directory_re = quotemeta("$directory/");
for my $t (string_list) {
! next if TmplTokenizer::blank_p($t) || $t =~ /^\d+$/;
my $cformat_p;
for my $token (@{$text{$t}}) {
--- 128,132 ----
my $directory_re = quotemeta("$directory/");
for my $t (string_list) {
! next if negligible_p($t);
my $cformat_p;
for my $token (@{$text{$t}}) {
***************
*** 162,166 ****
}
printf OUTPUT "#, c-format\n" if $cformat_p;
! printf OUTPUT "msgid %s\n", TmplTokenizer::quote_po( charset_convert $t );
printf OUTPUT "msgstr %s\n\n", (defined $translation{$t}?
TmplTokenizer::quote_po( $translation{$t} ): "\"\"");
--- 138,143 ----
}
printf OUTPUT "#, c-format\n" if $cformat_p;
! printf OUTPUT "msgid %s\n", TmplTokenizer::quote_po
! TmplTokenizer::charset_convert $t, $charset_in, $charset_out;
printf OUTPUT "msgstr %s\n\n", (defined $translation{$t}?
TmplTokenizer::quote_po( $translation{$t} ): "\"\"");
***************
*** 201,204 ****
--- 178,182 ----
}
}
+ # The following assumption is correct; that's what HTML::Template assumes
if (!defined $charset_in) {
$charset_in = $charset_out = TmplTokenizer::charset_canon 'iso8859-1';
***************
*** 224,227 ****
--- 202,206 ----
HTML::Template options:
+ -a, --extract-all Extract all strings
--pedantic-warnings Issue warnings even for detected problems
which are likely to be harmless
***************
*** 249,252 ****
--- 228,232 ----
Getopt::Long::config qw( bundling no_auto_abbrev );
GetOptions(
+ 'a|extract-all' => \$extract_all_p,
'charset=s' => sub { $charset_in = $charset_out = $_[1] }, # INTERNAL
'convert-from=s' => \$convert_from,
More information about the Koha-cvs
mailing list