Changeset 5094


Ignore:
Timestamp:
2003-08-04T17:17:53+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/buildcol.pl

    r4873 r5094  
    131131
    132132my $options = { 'name' => "buildcol.pl",
    133         'desc' => "PERL script used to build a greenstone collection from GML documents.",
     133        'desc' => "{buildcol.desc}",
    134134        'args' => $arguments };
    135135
     
    143143    print STDERR "<Info>\n";
    144144    print STDERR "  <Name>$options->{'name'}</Name>\n";
    145     print STDERR "  <Desc>$options->{'desc'}</Desc>\n";
     145    print STDERR "  <Desc>" . &lookup_string($options->{'desc'}) . "</Desc>\n";
    146146    print STDERR "  <Arguments>\n";
    147147    if (defined($options->{'args'})) {
     
    167167
    168168    # Produce the usage information using the data structure above
    169     print STDERR " usage: $programname [options] collection-name\n\n";
     169    print STDERR " " . &lookup_string("{common.usage}") . ": $programname";
     170    print STDERR " " . &lookup_string("{buildcol.params}") . "\n\n";
    170171
    171172    # Display the program options, if there are some
     
    174175    local $optiondescoffset = $descoffset + 2;  # 2 spaces between options & descriptions
    175176
    176     print STDERR " options:\n";
     177    print STDERR " " . &lookup_string("{common.options}") . ":\n";
    177178
    178179    # Display the program options
    179180    &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    180181    }
     182}
     183
     184
     185sub lookup_string
     186{
     187    return &PrintUsage::lookup_string($language, shift(@_));
    181188}
    182189
     
    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 = "buildcol::OUT";
    273281    $close_out = 1;
     
    287295    # this could potentially create a situation where the faillog keeps being added
    288296    # to over multiple builds (if the import process is being skipped)
    289     open (FAILLOG, ">>$faillog") || die "Couldn't open fail log $faillog\n";
     297    open (FAILLOG, ">>$faillog")
     298    || die &lookup_string("{common.cannot_open_fail_log}") . " $faillog\n";
    290299    $faillog = 'buildcol::FAILLOG';
    291300    $faillog->autoflush(1);
     
    362371   
    363372    } else {
    364     die "Couldn't find the configuration file $configfilename\n";
    365     }
    366        
     373    die &lookup_string("{common.cannot_find_cfg_file}") . " $configfilename\n";
     374    }
     375
    367376    #set the text index
    368377    if ($buildtype eq "mgpp") {
     
    394403    # update the archive cache if needed
    395404    if ($cachedir) {
    396     print $out "Updating archive cache\n" if ($verbosity >= 1);
     405    print $out &lookup_string("{buildcol.updating_archive_cache}") . "\n"
     406        if ($verbosity >= 1);
    397407
    398408    $cachedir =~ s/[\\\/]+$//;
     
    455465    $builder->make_infodatabase();
    456466    } else {
    457     die "unknown mode: $mode\n";
     467    die &lookup_string("{buildcol.unknown_mode}") . " $mode\n";
    458468    }
    459469
     
    462472   
    463473    if (($realbuilddir ne $builddir) && !$debug) {
    464     print $out "Copying back the cached build\n" if ($verbosity >= 1);
     474    print $out &lookup_string("{buildcol.copying_back_cached_build}") . "\n"
     475        if ($verbosity >= 1);
    465476    &util::rm_r ($builddir);
    466477    &util::cp_r ($realbuilddir, $builddir);
     
    476487    my $image_script = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "script", "gimp", "title_icon-1.2.pl");
    477488    if (!-e $image_script) {
    478     print $out "WARNING: Image making script ($image_script) could not be found\n";
    479     print $out "         Default images will not be generated\n\n";
     489    print $out &lookup_string("{buildcol.no_image_script}") . ": $image_script.";
     490    print $out &lookup_string("{buildcol.no_default_images}") . "\n\n";
    480491    return;
    481492    }
     
    492503    # to be changed when the config file format changes)
    493504    if (!open (CFGFILE, $configfilename)) {
    494     print $out "WARNING: Couldn't open config file ($configfilename)\n";
    495     print $out "         for updating so collection images may not be linked correctly\n";
     505    print $out &lookup_string("{buildcol.cannot_open_cfg_file}") . ": $configfilename\n";
     506    print $out &lookup_string("{buildcol.unlinked_col_images}") . "\n";
    496507    return;
    497508    }
     
    515526
    516527    if (!open (CFGFILE, ">$configfilename")) {
    517     print $out "WARNING: Couldn't open config file ($configfilename)\n";
    518     print $out "         for updating so collection images may not be linked correctly\n";
     528    print $out &lookup_string("{buildcol.cannot_open_cfg_file}") . ": $configfilename\n";
     529    print $out &lookup_string("{buildcol.unlinked_col_images}") . "\n";
    519530    return;
    520531    }
Note: See TracChangeset for help on using the changeset viewer.