Changeset 5093


Ignore:
Timestamp:
2003-08-04T16:36:18+12:00 (21 years ago)
Author:
mdewsnip
Message:

Moved all output messages into the resource bundle (perllib/strings.rb), in preparation for translation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/import.pl

    r4873 r5093  
    129129
    130130my $options = { 'name' => "import.pl",
    131         'desc' => "PERL script used to import files into a GML format ready for building.",
     131        'desc' => "{import.desc}",
    132132        'args' => $arguments };
    133133
     
    141141    print STDERR "<Info>\n";
    142142    print STDERR "  <Name>$options->{'name'}</Name>\n";
    143     print STDERR "  <Desc>$options->{'desc'}</Desc>\n";
     143    print STDERR "  <Desc>" . &lookup_string($options->{'desc'}) . "</Desc>\n";
    144144    print STDERR "  <Arguments>\n";
    145145    if (defined($options->{'args'})) {
     
    165165
    166166    # Produce the usage information using the data structure above
    167     print STDERR " usage: $programname [options] collection-name\n\n";
     167    print STDERR " " . &lookup_string("{common.usage}") . ": $programname";
     168    print STDERR " " . &lookup_string("{import.params}") . "\n\n";
    168169
    169170    # Display the program options, if there are some
     
    172173    local $optiondescoffset = $descoffset + 2;  # 2 spaces between options & descriptions
    173174
    174     print STDERR " options:\n";
     175    print STDERR " " . &lookup_string("{common.options}") . ":\n";
    175176
    176177    # Display the program options
    177178    &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    178179    }
     180}
     181
     182
     183sub lookup_string
     184{
     185    return &PrintUsage::lookup_string($language, shift(@_));
    179186}
    180187
     
    269276    my $close_out = 0;
    270277    if ($out !~ /^(STDERR|STDOUT)$/i) {
    271     open (OUT, ">$out") || die "Couldn't open output file $out\n";
     278    open (OUT, ">$out") ||
     279        die &lookup_string("{common.cannot_open_output_file}") . " $out\n";
    272280    $out = 'import::OUT';
    273281    $close_out = 1;
     
    287295    $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
    288296    }
    289     open (FAILLOG, ">$faillog") || die "Couldn't open fail log $faillog\n";
     297    open (FAILLOG, ">$faillog") ||
     298    die &lookup_string("{import.cannot_open_fail_log}") . " $faillog\n";
    290299    my $faillogname = $faillog;
    291300    $faillog = 'import::FAILLOG';
     
    295304    $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/;
    296305    if (defined $sortmeta && $groupsize > 1) {
    297     print $out "WARNING: import.pl cannot sort documents when groupsize > 1\n";
    298     print $out "         sortmeta option will be ignored\n\n";
     306    print $out &lookup_string("{import.cannot_sort}") . "\n\n";
    299307    $sortmeta = undef;
    300308    }
     
    377385
    378386    } else {
    379     die "Couldn't find the configuration file $configfilename\n";
     387    die &lookup_string("{import.cannot_find_cfg_file}") . " $configfilename\n";
    380388    }
    381389   
     
    392400    $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog);
    393401    if (scalar(@$pluginfo) == 0) {
    394     print $out "No plugins were loaded.\n";
     402    print $out &lookup_string("{import.no_plugins_loaded}") . "\n";
    395403    die "\n";
    396404    }
    397    
     405
    398406    # remove the old contents of the archives directory if needed
    399407    if ($removeold && -e $archivedir) {
    400     print $out "Removing current contents of the archives directory\n";
     408    print $out &lookup_string("{import.removing_archives}") . "\n";
    401409    sleep(3); # just in case...
    402410    &util::rm_r ($archivedir);
     
    438446        $close_stats = 1;
    439447    } else {
    440         print $out "WARNING: couldn't open stats file $statsfile\n";
    441         print $out "         will print stats to STDERR instead\n";
     448        print $out &lookup_string("{import.cannot_open_stats_file}") . " $statsfile.";
     449        print $out &lookup_string("{import.stats_backup}") . "\n";
    442450        $statsfile = 'STDERR';
    443451    }
     
    446454    print $out "\n";
    447455    print $out "*********************************************\n";
    448     print $out "Import Complete\n";
     456    print $out &lookup_string("{import.complete}") . "\n";
    449457    print $out "*********************************************\n";
    450458
     
    457465    close FAILLOG;
    458466}
    459 
Note: See TracChangeset for help on using the changeset viewer.