[Rt-commit] r18095 - in rt/3.999/branches/merge_to_3.8.2: .
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jan 30 01:21:05 EST 2009
Author: sunnavy
Date: Fri Jan 30 01:21:05 2009
New Revision: 18095
Modified:
rt/3.999/branches/merge_to_3.8.2/ (props changed)
rt/3.999/branches/merge_to_3.8.2/sbin/extract-message-catalog
rt/3.999/branches/merge_to_3.8.2/sbin/rt-dump-database
rt/3.999/branches/merge_to_3.8.2/sbin/rt-setup-database
rt/3.999/branches/merge_to_3.8.2/sbin/rt-shredder
Log:
r19378 at sunnavys-mb: sunnavy | 2009-01-30 14:19:47 +0800
auto-merged sbin
Modified: rt/3.999/branches/merge_to_3.8.2/sbin/extract-message-catalog
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/sbin/extract-message-catalog (original)
+++ rt/3.999/branches/merge_to_3.8.2/sbin/extract-message-catalog Fri Jan 30 01:21:05 2009
@@ -59,12 +59,17 @@
$DEBUG = 1;
- at ARGV = <lib/RT/I18N/*.po> unless @ARGV;
+# po dir is for extensions
+ at ARGV = (<lib/RT/I18N/*.po>, <lib/RT/I18N/*.pot>, <po/*.po>, <po/*.pot>) unless @ARGV;
$FILECAT = {};
# extract all strings and stuff them into $FILECAT
-File::Find::find( { wanted => \&extract_strings_from_code, follow => 1 }, '.' );
+# scan html dir for extensions
+File::Find::find( { wanted => \&extract_strings_from_code, follow => 1 }, qw(bin sbin lib share html etc) );
+
+# remove msgid with $ in it. XXX: perhaps give some warnings here
+$FILECAT = { map { $_ => $FILECAT->{$_} } grep { !m/\$/ } keys %$FILECAT };
# ensure proper escaping and %1 => %1 transformation
foreach my $str ( sort keys %{$FILECAT} ) {
@@ -83,11 +88,13 @@
# update all Language dictionaries
foreach my $dict (@ARGV) {
+ $dict = "lib/RT/I18N/$dict.pot" if ( $dict eq 'rt' );
$dict = "lib/RT/I18N/$dict.po" unless -f $dict or $dict =~ m!/!;
my $lang = $dict;
$lang =~ s|.*/||;
$lang =~ s|\.po$||;
+ $lang =~ s|\.pot$||;
update($lang, $dict);
}
@@ -101,7 +108,8 @@
local $/;
return if ( -d $_ );
return if ( $File::Find::dir =~ 'lib/blib|lib/t/autogen|var|m4|local|\.svn' );
- return if ( /\.po$|\.bak$|~|,D|,B$|extract-message-catalog$/ );
+ return if ( /\.(?:pot|po|bak|gif|png|psd|jpe?g|svg|css|js)$/ );
+ return if ( /~|,D|,B$|extract-message-catalog$|tweak-template-locstring$/ );
return if ( /^[\.#]/ );
return if ( -f "$_.in" );
@@ -156,6 +164,7 @@
$line = 1;
pos($_) = 0;
while (m/\G.*?($RE{delimited}{-delim=>q{'"}}{-keep})[\}\)\],;]*\s*\#\s*loc\s*$/smg) {
+
my $str = substr($1, 1, -1);
$line += ( () = ( $& =~ /\n/g ) ); # cryptocontext!
$str =~ s/\\'/\'/g;
@@ -197,19 +206,52 @@
@lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
while (@lines) {
my $msghdr = "";
- $msghdr .= shift @lines while ( $lines[0] && $lines[0] !~ /^msgid/ );
+ $msghdr .= shift @lines while ( $lines[0] && $lines[0] !~ /^(#~ )?msgid/ );
my $msgid = "";
- $msgid .= shift @lines while ( $lines[0] && $lines[0] =~ /^(msgid|")/ );
+
+# '#~ ' is the prefix of launchpad for msg that's not found the the source
+# we'll remove the prefix later so we can still show them with our own mark
+
+ $msgid .= shift @lines while ( $lines[0] && $lines[0] =~ /^(#~ )?(msgid|")/ );
my $msgstr = "";
- $msgstr .= shift @lines while ( $lines[0] && $lines[0] =~ /^(msgstr|")/ );
+ $msgstr .= shift @lines while ( $lines[0] && $lines[0] =~ /^(#~ )?(msgstr|")/ );
last unless $msgid;
chomp $msgid;
chomp $msgstr;
- $msgid =~ s/^msgid "(.*)"\s*?$/$1/ms or warn "$msgid in $file";
- $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/ms or warn "$msgstr in $file";
+
+ $msgid =~ s/^#~ //mg;
+ $msgstr =~ s/^#~ //mg;
+
+ $msgid =~ s/^msgid "(.*)"\s*?$/$1/m or warn "$msgid in $file";
+
+ if ( $msgid eq '' ) {
+ # null msgid, msgstr will have head info
+ $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/ms or warn "$msgstr in $file";
+ }
+ else {
+ $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/m or warn "$msgstr in $file";
+ }
+
+ if ( $msgid ne '' ) {
+ for my $msg ( \$msgid, \$msgstr ) {
+ if ( $$msg =~ /\n/ ) {
+ my @lines = split /\n/, $$msg;
+ $$msg =
+ shift @lines; # first line don't need to handle any more
+ for (@lines) {
+ if (/^"(.*)"\s*$/) {
+ $$msg .= $1;
+ }
+ }
+ }
+
+ # convert \\n back to \n
+ $$msg =~ s/(?!\\)\\n/\n/g;
+ }
+ }
$Lexicon{$msgid} = $msgstr;
$Header{$msgid} = $msghdr;
@@ -284,6 +326,23 @@
}
+sub fmt {
+ my $str = shift;
+ return "\"$str\"\n" unless $str =~ /\n/;
+
+ my $multi_line = ($str =~ /\n(?!\z)/);
+ $str =~ s/\n/\\n"\n"/g;
+
+ if ($str =~ /\n"$/) {
+ chop $str;
+ }
+ else {
+ $str .= "\"\n";
+ }
+ return $multi_line ? qq(""\n"$str) : qq("$str);
+}
+
+
__END__
# Local variables:
# c-indentation-style: bsd
Modified: rt/3.999/branches/merge_to_3.8.2/sbin/rt-dump-database
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/sbin/rt-dump-database (original)
+++ rt/3.999/branches/merge_to_3.8.2/sbin/rt-dump-database Fri Jan 30 01:21:05 2009
@@ -139,7 +139,7 @@
# next if $obj-> # skip default names
foreach my $field (sort keys %fields) {
my $value = $obj->__value($field);
- $rv->{$field} = $value if length($value);
+ $rv->{$field} = $value if ( defined ($value) && length($value) );
}
delete $rv->{disabled} unless $rv->{disabled};
Modified: rt/3.999/branches/merge_to_3.8.2/sbin/rt-setup-database
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/sbin/rt-setup-database (original)
+++ rt/3.999/branches/merge_to_3.8.2/sbin/rt-setup-database Fri Jan 30 01:21:05 2009
@@ -171,25 +171,39 @@
$0: Set up RT's database
---action init Initialize the database
- drop Drop the database.
- This will ERASE ALL YOUR DATA
- insert Insert data into RT's database.
- By default, will use RT's installation data.
- To use a local or supplementary datafile, specify it
- using the '--datafile' option below.
-
- acl Initialize only the database ACLs
- To use a local or supplementary datafile, specify it
- using the '--datadir' option below.
-
- schema Initialize only the database schema
- To use a local or supplementary datafile, specify it
- using the '--datadir' option below.
+--action init Initialize the database. This is combination of
+ multiple actions listed below. Create DB, schema,
+ setup acl, insert core data and initial data.
+
+ upgrade Apply all needed schema/acl/content updates (will ask
+ for version to upgrade from)
+
+ create Create the database.
+
+ drop Drop the database.
+ This will ERASE ALL YOUR DATA
+
+ schema Initialize only the database schema
+ To use a local or supplementary datafile, specify it
+ using the '--datadir' option below.
+
+ acl Initialize only the database ACLs
+ To use a local or supplementary datafile, specify it
+ using the '--datadir' option below.
+
+ coredata Insert data into RT's database. This data is required
+ for normal functioning of any RT instance.
+
+ insert Insert data into RT's database.
+ By default, will use RT's installation data.
+ To use a local or supplementary datafile, specify it
+ using the '--datafile' option below.
+
+Several actions can be combined using comma separated list.
--datafile /path/to/datafile
--datadir /path/to/ Used to specify a path to find the local
- database schema and acls to be installed.
+ database schema and acls to be installed.
--dba dba's username
Modified: rt/3.999/branches/merge_to_3.8.2/sbin/rt-shredder
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/sbin/rt-shredder (original)
+++ rt/3.999/branches/merge_to_3.8.2/sbin/rt-shredder Fri Jan 30 01:21:05 2009
@@ -86,7 +86,7 @@
=head2 --plugin '<plugin name>[=<arg>,<val>[;<arg>,<val>]...]'
-You can use plugins to select RT objects with variouse conditions.
+You can use plugins to select RT objects with various conditions.
See also --plugin list and --plugin help options.
=head2 --plugin list
More information about the Rt-commit
mailing list