App-I18N

 view release on metacpan or  search on metacpan

inc/Module/AutoInstall.pm  view on Meta::CPAN

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
        else {
            $DisabledTests{$_} = 1 for map { glob($_) } @tests;
        }
    }
 
    if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
        require Config;
        print
"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
 
        # make an educated guess of whether we'll need root permission.
        print "    (You may need to do that as the 'root' user.)\n"
          if eval '$>';
    }
    print "*** $class configuration finished.\n";
 
    chdir $cwd;
 
    # import to main::
    no strict 'refs';
    *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';

inc/Module/AutoInstall.pm  view on Meta::CPAN

552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
sub _has_cpanplus {
    return (
        $HasCPANPLUS = (
            $INC{'CPANPLUS/Config.pm'}
              or _load('CPANPLUS::Shell::Default')
        )
    );
}
 
# make guesses on whether we're under the CPAN installation directory
sub _under_cpan {
    require Cwd;
    require File::Spec;
 
    my $cwd  = File::Spec->canonpath( Cwd::cwd() );
    my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
 
    return ( index( $cwd, $cpan ) > -1 );
}

lib/App/I18N.pm  view on Meta::CPAN

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
            'Locale::Maketext::Extract::Plugin::PPI' => [ 'pm','pl' ],
            'tt2' => [ ],
            # 'perl' => ['pl','pm','js','json'],
            'perl' => [ '*' ],   # _( ) , gettext( ) , loc( ) ...
            'mason' => [ ] ,
            'generic' => [ '*' ],
        },
        verbose => 1, warnings => 1 );
}
 
sub guess_appname {
    return lc(basename(getcwd()));
}
 
sub pot_name {
    my $self = shift;
    return guess_appname();
}
 
 
sub _check_mime_type {
    my $self       = shift;
    my $local_path = shift;
    my $mimeobj = $MIME->mimeTypeOf($local_path);
    my $mime_type = ($mimeobj ? $mimeobj->type : "unknown");
    return if ( $mime_type =~ /^image/ );
    return if ( $mime_type =~ /compressed/ );  # ignore compressed archive files

lib/App/I18N.pm  view on Meta::CPAN

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 
    if( $cmd->{mo} ) {
        my $mofile = $translation;
        $mofile =~ s{\.po$}{.mo};
        $logger->info( "Generating MO file: $mofile" );
        system(qq{msgfmt -v $translation -o $mofile});
    }
}
 
sub guess_podir {
    my ($class,$cmd) = @_;
    my $podir;
    $podir = 'po' if -e 'po';
    $podir = 'locale' , $cmd->{locale} = 1 if -e 'locale';
    $podir ||= 'locale' if $cmd->{locale};
    $podir ||= 'po';
    return $podir;
}
 
sub get_po_path {

lib/App/I18N/Command/Auto.pm  view on Meta::CPAN

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unless( $self->{from} ) {
    return $logger->error( "--from [Language] is required. please specify your language to translate." );
}
 
 
# XXX: check this option
$self->{backend} ||= 'rest-google';
 
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
 
mkpath [ $podir ];
 
my $pot_name = App::I18N->pot_name;
my $potfile = File::Spec->catfile( $podir, $pot_name . ".pot") ;
if( ! -e $potfile ) {
    $logger->info( "$potfile not found." );
    return;
}

lib/App/I18N/Command/Gen.pm  view on Meta::CPAN

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
LAST UPDATE: $now
END
}
 
sub run {
    my ( $self, $type ) = @_;
 
    my $output_dir = $self->{output_dir} || getcwd();
    my $logger = App::I18N->logger();
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
    $self->{mo} = 1 if $self->{locale};
 
    use Encode;
    File::Path::mkpath [ $output_dir ];
 
    if( $self->{locale} ) {
 
 
    }
    else {

lib/App/I18N/Command/Lang.pm  view on Meta::CPAN

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
        $self->logger->info( "Generating MO file: $mofile" );
        system(qq{msgfmt -v $pofile -o $mofile});
    }
}
 
sub run {
    my ( $self, @langs ) = @_;
    my $logger = $self->logger();
 
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
    $self->{mo} = 1 if $self->{locale};
 
    mkpath [ $podir ];
 
    my $pot_name = App::I18N->pot_name;
 
    my $potfile = File::Spec->catfile( $podir, $pot_name . ".pot") ;
    if( ! -e $potfile ) {
        $logger->info( "$potfile not found." );
        return;

lib/App/I18N/Command/Parse.pm  view on Meta::CPAN

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        print _( "Hello %1" , \$world );
    }
 
END
}
 
sub run {
    my ( $self, @args ) = @_;
 
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
    $self->{mo} = 1 if $self->{locale};
 
    my @dirs = @args;
    App::I18N->extract_messages( @dirs );
 
    # update app.pot catalog
    mkpath [ $podir ];
 
    my $pot_name = App::I18N->pot_name;
    App::I18N->update_catalog( File::Spec->catfile( $podir, $pot_name . ".pot") );

lib/App/I18N/Command/Server.pm  view on Meta::CPAN

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#     }
#
 
 
sub run {
    my ($self) = @_;
 
 
    $self->{mo} = 1 if $self->{locale};
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
 
    my @dirs = @{ $self->{directories} || []  };
    my $logger = App::I18N->logger;
 
    # pre-process messages
    my $lme = App::I18N->lm_extract;
    if( @dirs ) {
        App::I18N->extract_messages( @dirs );
        mkpath [ $podir ];
        App::I18N->update_catalog(

lib/App/I18N/Command/Status.pm  view on Meta::CPAN

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    print "=" x ($value_width);
    print " " x ($rest_width);
    print "]";
}
 
sub run {
    my $self = shift;
    my $logger = $self->logger();
 
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
    $self->{mo} = 1 if $self->{locale};
 
    print "Translation Status:\n";
 
    my @pofiles = File::Find::Rule->file->name( "*.po" )->in( $podir );
    for my $pofile ( @pofiles ) {
        my $extract = Locale::Maketext::Extract->new;
 
        my $lang;
        if( $self->{locale} ) {

lib/App/I18N/Command/Update.pm  view on Meta::CPAN

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
sub options { (
    'podir=s'  => 'podir',
    'mo'       => 'mo',   # generate mo file
    'locale'   => 'locale',
    ) }
 
sub run {
    my ( $self, $lang ) = @_;
    my $logger = App::I18N->logger();
    my $podir = $self->{podir};
    $podir = App::I18N->guess_podir( $self ) unless $podir;
    $self->{mo} = 1 if $self->{locale};
 
    my @pofiles = File::Find::Rule->file->name( "*.po" )->in( $podir );
    for my $pofile ( @pofiles ) {
        $logger->info( "Updating $pofile" );
        if( $self->{mo} ) {
            my $mofile = $pofile;
            $mofile =~ s{\.po$}{.mo};
            $logger->info( "Updating $mofile" );
            qx{msgfmt -v $pofile -o $mofile};

share/static/Stream.js  view on Meta::CPAN

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
        } else {
        //No
            //Grab from the start of the start flag to the end of the chunk
            this.currentStream += packet.substr(startFlag);
             
            //Leave this.currentStream set and wait for another packet
        }
    } else {
        //WTF? No open stream and no start flag means someone fucked up the output
        //...OR maybe they're sending garbage in front of their first payload. Weird.
        //I guess just ignore it for now?
    }
//Else we have an open stream
} else {
    //Is there an end flag?
    if(endFlag > -1) {
    //Yes
        //Use the end flag to grab the rest of the payload
        var chunk = packet.substring(0, endFlag);
        this.currentStream += chunk;
        



( run in 0.297 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )