[Jifty-commit] r5471 - jifty/trunk/lib/Jifty/Script
Jifty commits
jifty-commit at lists.jifty.org
Fri May 16 13:03:53 EDT 2008
Author: ruz
Date: Fri May 16 13:03:52 2008
New Revision: 5471
Modified:
jifty/trunk/lib/Jifty/Script/Po.pm
jifty/trunk/lib/Jifty/Script/Schema.pm
Log:
* suggest to use `jifty po --language xxx` and point to help
when there is no po files
Modified: jifty/trunk/lib/Jifty/Script/Po.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Po.pm (original)
+++ jifty/trunk/lib/Jifty/Script/Po.pm Fri May 16 13:03:52 2008
@@ -113,17 +113,29 @@
sub update_catalogs {
my $self = shift;
- $self->extract_messages();
- my @catalogs = File::Find::Rule->file->in(
- Jifty->config->framework('L10N')->{'PoDir'} );
- if ($self->{'language'}) {
- $self->update_catalog( File::Spec->catfile( Jifty->config->framework('L10N')->{'PoDir'}, $self->{'language'} . ".po"));
+
+ if ($self->{'language'}) {
+ $self->extract_messages;
+ $self->update_catalog( File::Spec->catfile(
+ Jifty->config->framework('L10N')->{'PoDir'}, $self->{'language'} . ".po"
+ ) );
+ return;
+ }
+
+ my @catalogs = grep !m{(^|/)\.svn/}, File::Find::Rule->file->in(
+ Jifty->config->framework('L10N')->{'PoDir'}
+ );
+
+ unless ( @catalogs ) {
+ Jifty->log->error("You have no existing message catalogs.");
+ Jifty->log->error("Run `jifty po --language <lang>` to create a new one.");
+ Jifty->log->error("Read `jifty po --help` to get more info.");
+ return
}
- else {
- foreach my $catalog (@catalogs) {
- next if $catalog =~ m{(^|/)\.svn/};
- $self->update_catalog( $catalog );
- }
+
+ $self->extract_messages;
+ foreach my $catalog (@catalogs) {
+ $self->update_catalog( $catalog );
}
}
Modified: jifty/trunk/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Schema.pm (original)
+++ jifty/trunk/lib/Jifty/Script/Schema.pm Fri May 16 13:03:52 2008
@@ -10,6 +10,8 @@
use Jifty::Config;
use Jifty::Schema;
+### Help is below in __DATA__ section
+
=head2 options
Returns a hash of all the options this script takes. (See the usage message for details)
More information about the Jifty-commit
mailing list