View | Details | Raw Unified | Return to bug 9161
Collapse All | Expand All

(-)a/misc/translator/LangInstaller.pm (-12 / +27 lines)
Lines 303-309 sub install_prefs { Link Here
303
303
304
304
305
sub install_tmpl {
305
sub install_tmpl {
306
    my $self = shift;
306
    my ($self, $files) = @_;
307
    say "Install templates" if $self->{verbose};
307
    say "Install templates" if $self->{verbose};
308
    for my $trans ( @{$self->{interface}} ) {
308
    for my $trans ( @{$self->{interface}} ) {
309
        print
309
        print
Lines 318-330 sub install_tmpl { Link Here
318
            "$self->{process} install " .
318
            "$self->{process} install " .
319
            "-i $trans->{dir}/en/ " .
319
            "-i $trans->{dir}/en/ " .
320
            "-o $trans->{dir}/$self->{lang} ".
320
            "-o $trans->{dir}/$self->{lang} ".
321
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r"
321
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " .
322
            (
323
                $files
324
                    ? '-f ' . join ' -f ', @$files
325
                    : ''
326
            )
322
    }
327
    }
323
}
328
}
324
329
325
330
326
sub update_tmpl {
331
sub update_tmpl {
327
    my $self = shift;
332
    my ($self, $files) = @_;
328
333
329
    say "Update templates" if $self->{verbose};
334
    say "Update templates" if $self->{verbose};
330
    for my $trans ( @{$self->{interface}} ) {
335
    for my $trans ( @{$self->{interface}} ) {
Lines 338-344 sub update_tmpl { Link Here
338
        system
343
        system
339
            "$self->{process} update " .
344
            "$self->{process} update " .
340
            "-i $trans->{dir}/en/ " .
345
            "-i $trans->{dir}/en/ " .
341
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r"
346
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " .
347
            (
348
                $files
349
                    ? '-f ' . join ' -f ', @$files
350
                    : ''
351
            )
342
    }
352
    }
343
}
353
}
344
354
Lines 356-362 sub create_prefs { Link Here
356
366
357
367
358
sub create_tmpl {
368
sub create_tmpl {
359
    my $self = shift;
369
    my ($self, $files) = @_;
360
370
361
    say "Create templates\n" if $self->{verbose};
371
    say "Create templates\n" if $self->{verbose};
362
    for my $trans ( @{$self->{interface}} ) {
372
    for my $trans ( @{$self->{interface}} ) {
Lines 368-382 sub create_tmpl { Link Here
368
        system
378
        system
369
            "$self->{process} create " .
379
            "$self->{process} create " .
370
            "-i $trans->{dir}/en/ " .
380
            "-i $trans->{dir}/en/ " .
371
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r"
381
            "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " .
382
            (
383
                $files
384
                    ? '-f ' . join ' -f ', @$files
385
                    : ''
386
            )
372
    }
387
    }
373
}
388
}
374
389
375
390
376
sub install {
391
sub install {
377
    my $self = shift;
392
    my ($self, $files) = @_;
378
    return unless $self->{lang};
393
    return unless $self->{lang};
379
    $self->install_tmpl() unless $self->{pref_only};
394
    $self->install_tmpl($files) unless $self->{pref_only};
380
    $self->install_prefs();
395
    $self->install_prefs();
381
}
396
}
382
397
Lines 391-410 sub get_all_langs { Link Here
391
406
392
407
393
sub update {
408
sub update {
394
    my $self = shift;
409
    my ($self, $files) = @_;
395
    my @langs = $self->{lang} ? ($self->{lang}) : $self->get_all_langs();
410
    my @langs = $self->{lang} ? ($self->{lang}) : $self->get_all_langs();
396
    for my $lang ( @langs ) {
411
    for my $lang ( @langs ) {
397
        $self->set_lang( $lang );
412
        $self->set_lang( $lang );
398
        $self->update_tmpl() unless $self->{pref_only};
413
        $self->update_tmpl($files) unless $self->{pref_only};
399
        $self->update_prefs();
414
        $self->update_prefs();
400
    }
415
    }
401
}
416
}
402
417
403
418
404
sub create {
419
sub create {
405
    my $self = shift;
420
    my ($self, $files) = @_;
406
    return unless $self->{lang};
421
    return unless $self->{lang};
407
    $self->create_tmpl() unless $self->{pref_only};
422
    $self->create_tmpl($files) unless $self->{pref_only};
408
    $self->create_prefs();
423
    $self->create_prefs();
409
}
424
}
410
425
(-)a/misc/translator/translate (-3 / +4 lines)
Lines 30-38 use Pod::Usage; Link Here
30
my $verbose     = 0;
30
my $verbose     = 0;
31
my $pref        = 0;
31
my $pref        = 0;
32
my $all         = 0;
32
my $all         = 0;
33
my @files;
33
GetOptions(
34
GetOptions(
34
    'v|verbose' => \$verbose,
35
    'v|verbose' => \$verbose,
35
    'p'         => \$pref,
36
    'p'         => \$pref,
37
    'f:s'       => \@files,
36
    'a|all'     => \$all,
38
    'a|all'     => \$all,
37
);
39
);
38
40
Lines 57-67 if ( $cmd =~ /create|install|update/ ) { Link Here
57
        usage() if $cmd eq 'create';
59
        usage() if $cmd eq 'create';
58
        for my $lang ( @{$installer->{langs}} ) {
60
        for my $lang ( @{$installer->{langs}} ) {
59
            $installer->set_lang( $lang );
61
            $installer->set_lang( $lang );
60
            $installer->$cmd();
62
            $installer->$cmd(\@files);
61
        }
63
        }
62
    }
64
    }
63
    else {
65
    else {
64
        $installer->$cmd();
66
        $installer->$cmd(\@files);
65
    }
67
    }
66
}
68
}
67
else {
69
else {
68
- 

Return to bug 9161