Changeset 4873 for trunk/gsdl


Ignore:
Timestamp:
2003-07-03T15:59:04+12:00 (21 years ago)
Author:
mdewsnip
Message:

Further work on standardising option descriptions. Specifically, in preparation for translating the option descriptions into other languages, all the option description strings have been moved in a "resource bundle" file (modelled on a Java resource bundle). (This also has the advantage of reducing the number of duplicate descriptions). The option descriptions in the plugins, classifiers, mkcol.pl, import.pl and buildcol.pl have been replaced with keys into this resource bundle (perllib/strings.rb). When translating the strings in this file into a new language, the new resource bundle should be named strings_<language-code>.rb (where <language-code> is a combination of language and country, eg. 'fr_FR' for the version of French spoken in France).

To support these changes, the PrintUsage module (perllib/printusage.pm) has new code for reading resource bundles and displaying the correct strings. Also, pluginfo.pl, classinfo.pl, mkcol.pl, import.pl and buildcol.pl have a new option (-language) for specifying the language code to display option descriptions in.

If a resource bundle for the specified language code does not exist, a generic resource bundle is used (strings.rb). This currently contains the English text descriptions. However, for users who always use Greenstone in another language, it would be easier to rename the standard file to strings_en_US.rb and rename the resource bundle of their desired language to strings.rb. This would mean they would not have to constantly specify their language with the -language option, since the default resource bundle will suit them.

Currently, the encoding names (in encodings.pm) are not part of this scheme. These are displayed as part of BasPlug's input_encoding option. It is debatable whether these names would be worth translating into other languages.

Parse errors in plugins and classifiers currently cause them to display the usage information using the default resource bundle. It is likely that BasPlug will soon have an option added to specify the language for the usage information in this case. (Note that this does not include using pluginfo.pl or classinfo.pl to display usage information - these have a -language option).

Location:
trunk/gsdl
Files:
1 added
39 edited

Legend:

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

    r4776 r4873  
    4646my $mode_list =
    4747    [ { 'name' => "all",
    48         'desc' => "Do everything." },
     48        'desc' => "{buildcol.mode.all}" },
    4949      { 'name' => "compress_text",
    50         'desc' => "Just compress the text." },
     50        'desc' => "{buildcol.mode.compress_text}" },
    5151      { 'name' => "build_index",
    52         'desc' => "Just index the text." },
     52        'desc' => "{buildcol.mode.build_index}" },
    5353      { 'name' => "infodb",
    54         'desc' => "Just build the metadata database." } ];
     54        'desc' => "{buildcol.mode.infodb}" } ];
    5555
    5656my $arguments =
    5757    [ { 'name' => "archivedir",
    58     'desc' => "Where the archives live.",
     58    'desc' => "{buildcol.archivedir}",
    5959    'type' => "string",
    6060    'reqd' => "no" },
    6161      { 'name' => "verbosity",
    62     'desc' => "0=none, 3=lots",
     62    'desc' => "{buildcol.verbosity}",
    6363    'type' => "int",
    6464    'deft' => "2",
    6565    'reqd' => "no" },
    6666      { 'name' => "builddir",
    67     'desc' => "Where to put the built indexes.",
    68     'type' => "string",
    69     'reqd' => "no" },
    70       { 'name' => "cachedir",
    71     'desc' => "?",
    72     'type' => "string",
    73     'reqd' => "no" },
     67    'desc' => "{buildcol.builddir}",
     68    'type' => "string",
     69    'reqd' => "no" },
     70#     { 'name' => "cachedir",
     71#   'desc' => "{buildcol.cachedir}",
     72#   'type' => "string",
     73#   'reqd' => "no" },
    7474      { 'name' => "maxdocs",
    75     'desc' => "Maximum number of documents to build.",
     75    'desc' => "{buildcol.maxdocs}",
    7676    'type' => "int",
    7777    'reqd' => "no" },
    7878      { 'name' => "debug",
    79     'desc' => "Print output to STDOUT.",
     79    'desc' => "{buildcol.debug}",
    8080    'type' => "flag",
    8181    'reqd' => "no" },
    8282      { 'name' => "mode",
    83     'desc' => "The parts of the building process to carry out.",
     83    'desc' => "{buildcol.mode}",
    8484    'type' => "enum",
    8585    'list' => $mode_list,
     
    8787    'reqd' => "no" },
    8888      { 'name' => "index",
    89     'desc' => "Index to build (will build all in config file if not set).",
     89    'desc' => "{buildcol.index}",
    9090    'type' => "string",
    9191    'reqd' => "no" },
    9292      { 'name' => "keepold",
    93     'desc' => "Will not destroy the current contents of the building directory.",
     93    'desc' => "{buildcol.keepold}",
    9494    'type' => "flag",
    9595    'reqd' => "no" },
    96       { 'name' => "no_text",             
    97     'desc' => "Don't store compressed text. This option is useful for minimizing the size of the built indexes if you intend always to display the original documents at run time (i.e. you won't be able to retrieve the compressed text version).",
     96      { 'name' => "no_text",
     97    'desc' => "{buildcol.no_text}",
    9898    'type' => "flag",
    9999    'reqd' => "no" },
    100100      { 'name' => "allclassifications",
    101     'desc' => "Don't remove empty classifications.",
     101    'desc' => "{buildcol.allclassifications}",
    102102    'type' => "flag",
    103103    'reqd' => "no" },
    104104      { 'name' => "create_images",
    105     'desc' => "Attempt to create default images for new collection. This relies on the Gimp being installed along with relevant perl modules to allow scripting from perl.",
     105    'desc' => "{buildcol.create_images}",
    106106    'type' => "flag",
    107107    'reqd' => "no" },
    108108      { 'name' => "collectdir",
    109     'desc' => "Collection directory.",
     109    'desc' => "{buildcol.collectdir}",
    110110    'type' => "string",
    111111    'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
    112112    'reqd' => "no" },
    113113      { 'name' => "out",
    114     'desc' => "Filename or handle to print output status to.",
     114    'desc' => "{buildcol.out}",
    115115    'type' => "string",
    116116    'deft' => "STDERR",
    117117    'reqd' => "no" },
    118118      { 'name' => "no_strip_html",
    119     'desc' => "Do not strip the html tags from the indexed text (only used for mgpp collections).",
     119    'desc' => "{buildcol.no_strip_html}",
    120120    'type' => "flag",
    121121    'reqd' => "no" },
    122122      { 'name' => "faillog",
    123     'desc' => "Fail log filename. This log receives the filenames of any files which fail to be processed.",
     123    'desc' => "{buildcol.faillog}",
    124124    'type' => "string",
    125125    'deft' => &util::filename_cat("<collectdir>", "colname", "etc", "fail.log"),
     126    'reqd' => "no" },
     127      { 'name' => "language",
     128    'desc' => "{scripts.language}",
     129    'type' => "string",
    126130    'reqd' => "no" } ];
    127131
     
    133137sub print_xml_usage
    134138{
     139    local $language = shift(@_);
     140
    135141    &PrintUsage::print_xml_header();
    136142
     
    140146    print STDERR "  <Arguments>\n";
    141147    if (defined($options->{'args'})) {
    142     &PrintUsage::print_options_xml($options->{'args'});
     148    &PrintUsage::print_options_xml($language, $options->{'args'});
    143149    }
    144150    print STDERR "  </Arguments>\n";
     
    149155sub print_txt_usage
    150156{
     157    local $language = shift(@_);
     158
    151159    local $programname = $options->{'name'};
    152160    local $programargs = $options->{'args'};
     
    169177
    170178    # Display the program options
    171     &PrintUsage::print_options_txt($programargs, $optiondescoffset);
     179    &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    172180    }
    173181}
     
    222230    $debug, $mode, $indexname, $keepold, $allclassifications,
    223231    $create_images, $collectdir, $out, $buildtype, $textindex,
    224     $no_strip_html, $no_text, $faillog);
     232    $no_strip_html, $no_text, $faillog, $language);
    225233
    226234    # ***** 11-04-03 - John Thompson *****
     
    231239    # later (after we check the collect.cfg file)
    232240    if (!parsargv::parse(\@ARGV,
     241             'language/.*/', \$language,
    233242             'verbosity/\d+/', \$verbosity,
    234243             'archivedir/.*/', \$archivedir,
    235              'cachedir/.*/', \$cachedir,
     244             'cachedir/.*/', \$cachedir,  # UNDOCUMENTED
    236245             'builddir/.*/', \$builddir,
    237246             'maxdocs/^\-?\d+/', \$maxdocs,
     
    248257             'faillog/.*/', \$faillog,
    249258             q^xml^, \$xml)) {
    250     &print_txt_usage();
     259    &print_txt_usage($language);
    251260    die "\n";
    252261    }
    253262
    254263    if ($xml) {
    255         &print_xml_usage();
     264        &print_xml_usage($language);
    256265    die "\n";
    257266    }
     
    268277    # get and check the collection
    269278    if (($collection = &util::use_collection(@ARGV, $collectdir)) eq "") {
    270     &print_txt_usage();
     279    &print_txt_usage($language);
    271280    die "\n";
    272281    }
  • trunk/gsdl/bin/script/classinfo.pl

    r4779 r4873  
    4242    print STDERR "\n";
    4343    print STDERR "classinfo.pl: Prints information about a classifier.\n\n";
    44     print STDERR "  usage: $0 [options] classifier\n\n";
    45     print STDERR "  options:\n";
    46     print STDERR "   -collect collection-name  Giving a collection name will make\n";
    47     print STDERR "         classinfo.pl look in collect/collection-name/perllib/classify\n";
    48     print STDERR "         first. If it doesn't find it there it will look in the general\n";
    49     print STDERR "         perllib/classify directory.\n\n";
    50     print STDERR "   -xml                      Produces the information in an xml form, without\n";
    51     print STDERR "                             'pretty' comments but with much more detail.\n";
     44    print STDERR " usage: $0 [options] classifier\n\n";
     45    print STDERR " options:\n";
     46    print STDERR "  -collect collection-name  Giving a collection name will make classinfo.pl\n";
     47    print STDERR "                            look in collect/collection-name/perllib/classify\n";
     48    print STDERR "                            first. If the classifier is not found there it will\n";
     49    print STDERR "                            look in the general perllib/classify directory.\n\n";
     50    print STDERR "  -xml                      Produces the information in an xml form, without\n";
     51    print STDERR "                            'pretty' comments but with much more detail.\n\n";
     52    print STDERR "  -language language-code   Language to display plugin options in (eg. 'en_US'\n";
     53    print STDERR "                            specifies American English). Requires translations\n";
     54    print STDERR "                            of the option descriptions to exist in the\n";
     55    print STDERR "                            perllib/strings_language-code.rb file.\n";
    5256}
    5357
     
    5761    my $collect = "";
    5862    my $xml = 0;
     63    my $language = "";  # Will display in the default language if not set
    5964
    6065    # Parse command line
    61     if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
     66    if (!parsargv::parse(\@ARGV,
     67             q^collect/.*/^, \$collect,
     68             q^xml^, \$xml,
     69             q^language/.*/^, \$language))
    6270    {
    6371    &print_usage();
     
    8492
    8593    if ($xml) {
    86         $classobj->print_xml_usage();
     94        $classobj->print_xml_usage($language);
    8795    }
    8896    else {
     
    101109    print STDERR "General options are inherited from parent classes of the classifer.\n\n";
    102110
    103     $classobj->print_txt_usage();
     111    $classobj->print_txt_usage($language);
    104112    }
    105113}
  • trunk/gsdl/bin/script/import.pl

    r4776 r4873  
    5050my $oidtype_list =
    5151    [ { 'name' => "hash",
    52         'desc' => "Hashes the contents of the file. Document identifier will be the same every time the collection is imported." },
     52        'desc' => "{import.OIDtype.hash}" },
    5353      { 'name' => "incremental",
    54         'desc' => "A simple document count that is significantly faster than \"hash\". It is not guaranteed to always assign the same identifier to a given document though and does not allow further documents to be added to existing xml archives." } ];
     54        'desc' => "{import.OIDtype.incremental}" } ];
    5555
    5656my $arguments =
    5757    [ { 'name' => "archivedir",
    58     'desc' => "Where the converted material ends up.",
     58    'desc' => "{import.achivedir}",
    5959    'type' => "string",
    6060    'reqd' => "no" },
    6161      { 'name' => "collectdir",
    62     'desc' => "Collection directory.",
     62    'desc' => "{import.collectdir}",
    6363    'type' => "string",
    6464    'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
    6565    'reqd' => "no" },
    6666      { 'name' => "debug",
    67     'desc' => "Print imported text to STDOUT.",
     67    'desc' => "{import.debug}",
    6868    'type' => "flag",
    6969    'reqd' => "no" },
    7070      { 'name' => "faillog",
    71     'desc' => "Fail log filename. This log receives the filenames of any files which fail to be processed.",
     71    'desc' => "{import.faillog}",
    7272    'type' => "string",
    7373    'deft' => &util::filename_cat("<collectdir>", "colname", "etc", "fail.log"),
    7474    'reqd' => "no" },
    7575      { 'name' => "groupsize",
    76     'desc' => "Number of import documents to group into one XML file.",
     76    'desc' => "{import.groupsize}",
    7777    'type' => "int",
    7878    'deft' => "1",
    7979    'reqd' => "no" },
    8080      { 'name' => "gzip",
    81     'desc' => "Use gzip to compress resulting xml documents (don't forget to include ZIPPlug in your plugin list when building from compressed documents).",
     81    'desc' => "{import.gzip}",
    8282    'type' => "flag",
    8383    'reqd' => "no" },
    8484      { 'name' => "importdir",
    85     'desc' => "Where the original material lives.",
     85    'desc' => "{import.importdir}",
    8686    'type' => "string",
    8787    'reqd' => "no" },
    8888      { 'name' => "keepold",
    89     'desc' => "Will not destroy the current contents of the archives directory (the default).",
     89    'desc' => "{import.keepold}",
    9090    'type' => "flag",
    9191    'reqd' => "no" },
    9292      { 'name' => "maxdocs",
    93     'desc' => "Maximum number of documents to import.",
     93    'desc' => "{import.maxdocs}",
    9494    'type' => "int",
    9595    'reqd' => "no" },
    9696      { 'name' => "OIDtype",
    97     'desc' => "The method to use when generating unique identifiers for each document.",
     97    'desc' => "{import.OIDtype}",
    9898    'type' => "enum",
    9999    'list' => $oidtype_list,
     
    101101    'reqd' => "no" },
    102102      { 'name' => "out",
    103     'desc' => "Filename or handle to print output status to.",
     103    'desc' => "{import.out}",
    104104    'type' => "string",
    105105    'deft' => "STDERR",
    106106    'reqd' => "no" },
    107107      { 'name' => "removeold",
    108     'desc' => "Will remove the old contents of the archives directory -- use with care.",
     108    'desc' => "{import.removeold}",
    109109    'type' => "flag",
    110110    'reqd' => "no" },
    111111      { 'name' => "sortmeta",
    112     'desc' => "Sort documents alphabetically by metadata for building. This will be disabled if groupsize > 1.",
     112    'desc' => "{import.sortmeta}",
    113113    'type' => "string",
    114114    'reqd' => "no" },
    115115      { 'name' => "statsfile",
    116     'desc' => "Filename or handle to print import statistics to.",
     116    'desc' => "{import.statsfile}",
    117117    'type' => "string",
    118118    'deft' => "STDERR",
    119119    'reqd' => "no" },
    120120      { 'name' => "verbosity",
    121     'desc' => "0=none, 3=lots",
     121    'desc' => "{import.verbosity}",
    122122    'type' => "int",
    123123    'deft' => "2",
     124    'reqd' => "no" },
     125      { 'name' => "language",
     126    'desc' => "{scripts.language}",
     127    'type' => "string",
    124128    'reqd' => "no" } ];
    125129
     
    131135sub print_xml_usage
    132136{
     137    local $language = shift(@_);
     138
    133139    &PrintUsage::print_xml_header();
    134140
     
    138144    print STDERR "  <Arguments>\n";
    139145    if (defined($options->{'args'})) {
    140     &PrintUsage::print_options_xml($options->{'args'});
     146    &PrintUsage::print_options_xml($language, $options->{'args'});
    141147    }
    142148    print STDERR "  </Arguments>\n";
     
    147153sub print_txt_usage
    148154{
     155    local $language = shift(@_);
     156
    149157    local $programname = $options->{'name'};
    150158    local $programargs = $options->{'args'};
     
    167175
    168176    # Display the program options
    169     &PrintUsage::print_options_txt($programargs, $optiondescoffset);
     177    &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    170178    }
    171179}
     
    224232    $maxdocs, $collection, $configfilename, $collectcfg,
    225233    $pluginfo, $sortmeta, $archive_info_filename, $statsfile,
    226     $archive_info, $processor, $out, $faillog, $collectdir);
     234    $archive_info, $processor, $out, $faillog, $collectdir, $language);
    227235
    228236    # ***** 11-04-03 - John Thompson *****
     
    233241    # later (after we check the collect.cfg file)
    234242    if (!parsargv::parse(\@ARGV,
     243             'language/.*/', \$language,
    235244             'verbosity/\d+/', \$verbosity,
    236245             'importdir/.*/', \$importdir,
     
    249258             'faillog/.*/', \$faillog,
    250259             q^xml^, \$xml)) {
    251     &print_txt_usage();
     260    &print_txt_usage($language);
    252261    die "\n";
    253262    }
    254263
    255264    if ($xml) {
    256         &print_xml_usage();
     265        &print_xml_usage($language);
    257266    die "\n";
    258267    }
     
    271280    # get and check the collection name
    272281    if (($collection = &util::use_collection(@ARGV, $collectdir)) eq "") {
    273     &print_txt_usage();
     282    &print_txt_usage($language);
    274283    die "\n";
    275284    }
  • trunk/gsdl/bin/script/mkcol.pl

    r4776 r4873  
    4646my $arguments =
    4747    [ { 'name' => "creator",
    48     'desc' => "The collection creator's e-mail address.",
     48    'desc' => "{mkcol.creator}",
    4949    'type' => "string",
    5050    'reqd' => "yes" },
    5151      { 'name' => "optionfile",
    52     'desc' => "Get options from file, useful on systems where long command lines may cause problems.",
     52    'desc' => "{mkcol.optionfile}",
    5353    'type' => "string",
    5454    'reqd' => "no" },
    5555      { 'name' => "maintainer",
    56     'desc' => "The collection maintainer's email address (if different from the creator).",
     56    'desc' => "{mkcol.maintainer}",
    5757    'type' => "string",
    5858    'reqd' => "no" },
    5959      { 'name' => "collectdir",
    60     'desc' => "Directory where new collection will be created.",
     60    'desc' => "{mkcol.collectdir}",
    6161    'type' => "string",
    6262    'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
    6363    'reqd' => "no" },
    6464      { 'name' => "public",
    65     'desc' => "If this collection has anonymous access (true/false).",
     65    'desc' => "{mkcol.public}",
    6666    'type' => "string",
    6767    'deft' => "true",
    6868    'reqd' => "no" },
    6969      { 'name' => "title",
    70     'desc' => "The title of the collection.",
     70    'desc' => "{mkcol.title}",
    7171    'type' => "string",
    7272    'reqd' => "no" },
    7373      { 'name' => "about",
    74     'desc' => "The about text for the collection.",
     74    'desc' => "{mkcol.about}",
    7575    'type' => "string",
    7676    'reqd' => "no" },
    7777      { 'name' => "plugin",
    78     'desc' => "Perl plugin module to use (there may be multiple plugin entries).",
     78    'desc' => "{mkcol.plugin}",
    7979    'type' => "string",
    8080    'reqd' => "no" },
    8181      { 'name' => "quiet",
    82     'desc' => "Operate quietly.",
     82    'desc' => "{mkcol.quiet}",
    8383    'type' => "flag",
     84    'reqd' => "no" },
     85      { 'name' => "language",
     86    'desc' => "{scripts.language}",
     87    'type' => "string",
    8488    'reqd' => "no" } ];
    8589
     
    9195sub print_xml_usage
    9296{
     97    local $language = shift(@_);
     98
    9399    &PrintUsage::print_xml_header();
    94100
     
    98104    print STDERR "  <Arguments>\n";
    99105    if (defined($options->{'args'})) {
    100     &PrintUsage::print_options_xml($options->{'args'});
     106    &PrintUsage::print_options_xml($language, $options->{'args'});
    101107    }
    102108    print STDERR "  </Arguments>\n";
     
    107113sub print_txt_usage
    108114{
     115    local $language = shift(@_);
     116
    109117    local $programname = $options->{'name'};
    110118    local $programargs = $options->{'args'};
     
    127135
    128136    # Display the program options
    129     &PrintUsage::print_options_txt($programargs, $optiondescoffset);
     137    &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    130138    }
    131139}
     
    221229    my ($argref) = @_;
    222230    if (!&parsargv::parse($argref,
     231              'language/.*/', \$language,
    223232              'optionfile/.*/', \$optionfile,
    224233              'collectdir/.*/', \$collectdir,
     
    232241              q^xml^, \$xml
    233242              )) {
    234     &print_txt_usage();
     243    &print_txt_usage($language);
    235244    die "\n";
    236245    }
     
    242251
    243252    if ($xml) {
    244     &print_xml_usage();
     253    &print_xml_usage($language);
    245254    die "\n";
    246255    }
     
    255264    close OPTIONS;
    256265    &parse_args ($options);
    257 
    258266    }
    259267
     
    268276    if (!defined($collection)) {
    269277    print STDOUT "ERROR: no collection name was specified\n";
    270     &print_txt_usage();
     278    &print_txt_usage($language);
    271279    die "\n";
    272280    }
  • trunk/gsdl/bin/script/pluginfo.pl

    r4779 r4873  
    4444    print STDERR "\n";
    4545    print STDERR "pluginfo.pl: Prints information about a plugin.\n\n";
    46     print STDERR "  usage: $0 [options] plugin\n\n";
    47     print STDERR "  options:\n";
    48     print STDERR "   -collect collection-name  Giving a collection name will make pluginfo.pl\n";
    49     print STDERR "                             look in collect/collection-name/perllib/plugins\n";
    50     print STDERR "                             for plugin first. If it doesn't find it there\n";
    51     print STDERR "                             it will look in the general perllib/plugins\n";
    52     print STDERR "                             directory\n";
    53     print STDERR "   -xml                      Produces the information in an xml form, without\n";
    54     print STDERR "                             'pretty' comments but with much more detail.\n";
     46    print STDERR " usage: $0 [options] plugin\n\n";
     47    print STDERR " options:\n";
     48    print STDERR "  -collect collection-name  Giving a collection name will make pluginfo.pl\n";
     49    print STDERR "                            look in collect/collection-name/perllib/plugins\n";
     50    print STDERR "                            first. If the plugin is not found there it will\n";
     51    print STDERR "                            look in the general perllib/plugins directory.\n\n";
     52    print STDERR "  -xml                      Produces the information in an xml form, without\n";
     53    print STDERR "                            'pretty' comments but with much more detail.\n\n";
     54    print STDERR "  -language language-code   Language to display plugin options in (eg. 'en_US'\n";
     55    print STDERR "                            specifies American English). Requires translations\n";
     56    print STDERR "                            of the option descriptions to exist in the\n";
     57    print STDERR "                            perllib/strings_language-code.rb file.\n";
    5558}
    5659
     
    6164    my $collect = "";
    6265    my $xml = 0;
     66    my $language = "";  # Will display in the default language if not set
    6367
    64     if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
     68    if (!parsargv::parse(\@ARGV,
     69             q^collect/.*/^, \$collect,
     70             q^xml^, \$xml,
     71             q^language/.*/^, \$language))
    6572    {
    6673    &print_usage();
     
    8289
    8390    my $pluginfo = &plugin::load_plugins ([[$plugin]]);
    84      
    8591    my $plugobj = shift @$pluginfo;
    8692
    87     if ($xml) { 
    88         $plugobj->print_xml_usage();
     93    if ($xml) {
     94        $plugobj->print_xml_usage($language);
    8995    }
    9096    else {
    91     my $pluginfo = &plugin::load_plugins ([[$plugin]]);
    92 
    93     my $plugobj = shift @$pluginfo;
    94 
    9597    print STDERR "\n$plugin info:\n\n";
    9698
     
    105107    print STDERR "General options are inherited from parent classes of the plugin.\n\n";
    106108
    107     $plugobj->print_txt_usage();
     109    $plugobj->print_txt_usage($language);
    108110
    109111#   print STDERR " The default process_exp for $plugin is: ";
  • trunk/gsdl/perllib/classify/AZCompactList.pm

    r4840 r4873  
    5252my $doclevel_list =
    5353    [ { 'name' => "top",
    54     'desc' => "Whole document." } ,
     54    'desc' => "{AZCompactList.doclevel.top}" },
    5555      { 'name' => "section",
    56     'desc' => "By sections." } ];
     56    'desc' => "{AZCompactList.doclevel.section}" } ];
    5757
    5858my $arguments =
    5959    [ { 'name' => "metadata",
    60     'desc' => "Metadata field used for classification. List will be sorted by this element.",
     60    'desc' => "{AZCompactList.metadata}",
    6161    'type' => "metadata",
    6262    'reqd' => "yes" },
    6363      { 'name' => "buttonname",
    64     'desc' => "Button name for this classification.",
     64    'desc' => "{AZCompactList.buttonname}",
    6565    'type' => "string",
    6666    'deft' => "Metadata element specified with -metadata",
    6767    'reqd' => "no" },
    6868      { 'name' => "removeprefix",
    69     'desc' => "A prefix to ignore in the Metadata values for the field when sorting.",
     69    'desc' => "{AZCompactList.removeprefix}",
    7070    'type' => "string",
    7171    'deft' => "",
     
    7777    'reqd' => "no" },
    7878      { 'name' => "mingroup",
    79     'desc' => "The smallest value that will cause a group in the hierarchy to form.",
     79    'desc' => "{AZCompactList.mingroup}",
    8080    'type' => "int",
    8181    'deft' => "2",
    8282    'reqd' => "no" },
    8383      { 'name' => "minnesting",
    84     'desc' => "The smallest value that will cause a list to converted into nested list.",
     84    'desc' => "{AZCompactList.minnesting}",
    8585    'type' => "int",
    8686    'deft' => "20",
    8787    'reqd' => "no" },
    8888      { 'name' => "mincompact",
    89     'desc' => "Minimum number of documents to be displayed per page.",
     89    'desc' => "{AZCompactList.mincompact}",
    9090    'type' => "int",
    9191    'deft' => "10",
    9292    'reqd' => "no" },
    9393      { 'name' => "maxcompact",
    94     'desc' => "Maximum number of documents to be displayed per page.",
     94    'desc' => "{AZCompactList.maxcompact}",
    9595    'type' => "int",
    9696    'deft' => "30",
    9797    'reqd' => "no" },
    9898      { 'name' => "doclevel",
    99     'desc' => "Level to process document at.",
     99    'desc' => "{AZCompactList.doclevel}",
    100100    'type' => "enum",
    101101    'list' => $doclevel_list,
     
    103103    'reqd' => "no" },
    104104      { 'name' => "onlyfirst",
    105     'desc' => "Control whether all or only first metadata value used from array of metadata.",
     105    'desc' => "{AZCompactList.onlyfirst}",
    106106    'type' => "flag",
    107107    'reqd' => "no" },
    108108      { 'name' => "freqsort",
    109     'desc' => "Sort by node frequency rather than alpha-numeric.",
    110     'type' => "flag"},
    111       { 'name' => "recopt",
    112     'desc' => "?",
    113     'type' => "string",
    114     'deft' => "" } ];
     109    'desc' => "{AZCompactList.freqsort}",
     110    'type' => "flag"} ];
     111#      { 'name' => "recopt",
     112#   'desc' => "{AZCompactList.recopt}",
     113#   'type' => "string",
     114#   'deft' => "" } ];
    115115
    116116my $options =
     
    169169             q^onlyfirst/.*/0^, \$onlyfirst,
    170170             q^freqsort/.*/0^, \$freqsort,
    171              q^recopt/.*/-1^, \$recopt,
     171             q^recopt/.*/-1^, \$recopt,  # UNDOCUMENTED (what does it do?!?)
    172172
    173173             "allow_extra_options")) {
    174174   
    175175    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    176     $self->print_txt_usage();
     176    $self->print_txt_usage("");  # Use default resource bundle
    177177    die "\n";
    178178    }
  • trunk/gsdl/perllib/classify/AZList.pm

    r4840 r4873  
    3838my $arguments =
    3939    [ { 'name' => "metadata",
    40     'desc' => "Metadata field used for classification. List will be sorted by this element.",
     40    'desc' => "{AZList.metadata}",
    4141    'type' => "metadata",
    4242    'reqd' => "yes" } ,
    4343      { 'name' => "buttonname",
    44     'desc' => "Button name for this classification.",
     44    'desc' => "{AZList.buttonname}",
    4545    'type' => "string",
    4646    'deft' => "Metadata element specified with -metadata",
    4747    'reqd' => "no" },
    4848      { 'name' => "removeprefix",
    49     'desc' => "A prefix to ignore in the Metadata values for the field when sorting.",
     49    'desc' => "{AZList.removeprefix}",
    5050    'type' => "string",
    5151    'deft' => "",
     
    9797   
    9898    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    99     $self->print_txt_usage();
     99    $self->print_txt_usage("");  # Use default resource bundle
    100100    die "\n";
    101101    }
    102102
    103103    if (!defined $metaname) {
    104     $self->print_txt_usage();
     104    $self->print_txt_usage("");  # Use default resource bundle
    105105    print STDERR "AZList used with no metadata name\n";
    106106    die "\n";
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r4786 r4873  
    4747my $arguments =
    4848    [ { 'name' => "metadata",
    49     'desc' => "Metadata field used for classification. List will be sorted by this element.",
     49    'desc' => "{AZList.metadata}",
    5050    'type' => "metadata",
    5151    'reqd' => "yes" },
    5252      { 'name' => "buttonname",
    53     'desc' => "Button name for this classification.",
     53    'desc' => "{AZList.buttonname}",
    5454    'type' => "string",
    5555    'deft' => "Metadata element specified with -metadata",
  • trunk/gsdl/perllib/classify/BasClas.pm

    r4786 r4873  
    5555use printusage;
    5656
    57 my $verbosity_list =
    58     [ { 'name' => "0",
    59     'desc' => "No output." },
    60       { 'name' => "1",
    61     'desc' => "A little bit of output." },
    62       { 'name' => "2",
    63     'desc' => "Some output." },
    64       { 'name' => "3",
    65     'desc' => "Lots of output." } ];
    6657
    6758my $arguments =
    6859    [ { 'name' => "builddir",
    69     'desc' => "Where to put the built indexes.",
     60    'desc' => "{BasClas.builddir}",
    7061    'type' => "string",
    7162    'deft' => "" },
    7263      { 'name' => "outhandle",
    73     'desc' => "The file handle to write output to.",
     64    'desc' => "{BasClas.outhandle}",
    7465    'type' => "string",
    7566    'deft' => "STDERR" },
    7667      { 'name' => "verbosity",
    77     'desc' => "Controls the quantity of output.",
     68    'desc' => "{BasClas.verbosity}",
    7869    'type' => "enum",
    79     'list' => $verbosity_list,
    8070    'deft' => "2",
    8171    'reqd' => "no" } ];
     
    9080{
    9181    local $self = shift(@_);
    92 
    93     print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
    94     $self->print_xml();
     82    local $language = shift(@_);
     83
     84    &PrintUsage::print_xml_header();
     85    $self->print_xml($language);
    9586}
    9687
     
    9990{
    10091    local $self = shift(@_);
     92    local $language = shift(@_);
    10193
    10294    local $optionlistref = $self->{'option_list'};
     
    111103    print STDERR "  <Arguments>\n";
    112104    if (defined($classifieroptions->{'args'})) {
    113     &PrintUsage::print_options_xml($classifieroptions->{'args'});
     105    &PrintUsage::print_options_xml($language, $classifieroptions->{'args'});
    114106    }
    115107
    116108    # Recurse up the classifier hierarchy
    117     $self->print_xml();
     109    $self->print_xml($language);
    118110
    119111    print STDERR "  </Arguments>\n";
     
    125117{
    126118    local $self = shift(@_);
     119    local $language = shift(@_);
    127120
    128121    # Print the usage message for a classifier (recursively)
    129122    local $descoffset = $self->determine_description_offset(0);
    130     $self->print_classifier_usage($descoffset, 1);
     123    $self->print_classifier_usage($language, $descoffset, 1);
    131124}
    132125
     
    161154{
    162155    local $self = shift(@_);
     156    local $language = shift(@_);
    163157    local $descoffset = shift(@_);
    164158    local $isleafclass = shift(@_);
     
    190184
    191185    # Display the classifier options
    192     &PrintUsage::print_options_txt($classifierargs, $optiondescoffset);
     186    &PrintUsage::print_options_txt($language, $classifierargs, $optiondescoffset);
    193187    }
    194188
    195189    # Recurse up the classifier hierarchy
    196     $self->print_classifier_usage($descoffset, 0);
     190    $self->print_classifier_usage($language, $descoffset, 0);
    197191    $self->{'option_list'} = \@optionlist;
    198192}
     
    237231    print STDERR "(general options are those available to all classifiers).\n";
    238232    print STDERR "Check your collect.cfg configuration file.\n";
    239     &print_txt_usage();
     233    $self->print_txt_usage("");  # Use default resource bundle
    240234    die "\n";
    241235    }
    242 
    243 
    244236
    245237    return bless $self, $class;
  • trunk/gsdl/perllib/classify/DateList.pm

    r4786 r4873  
    4646my $arguments =
    4747    [ { 'name' => "bymonth",
    48     'desc' => "Classify by year and month.",
     48    'desc' => "{DateList.bymonth}",
    4949    'type' => "flag",
    5050    'reqd' => "no" } ];
     
    8282                         q^bymonth^, \$self->{'bymonth'},
    8383                         "allow_extra_options")) {
    84     $self->print_txt_usage();
     84    $self->print_txt_usage("");  # Use default resource bundle
    8585    die "\n";
    8686    }
  • trunk/gsdl/perllib/classify/HTML.pm

    r4786 r4873  
    4343my $arguments =
    4444    [ { 'name' => "url",
    45     'desc' => "The url of the web page to link to.",
     45    'desc' => "{HTML.url}",
    4646    'type' => "string",
    4747    'reqd' => "yes" } ,
    4848      { 'name' => "buttonname",
    49     'desc' => "The title field for this classification.",
     49    'desc' => "{HTML.buttonname}",
    5050    'type' => "string",
    5151    'deft' => "Browse",
     
    8686   
    8787    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    88     $self->print_txt_usage();
     88    $self->print_txt_usage("");  # Use default resource bundle
    8989    die "\n";
    9090    }
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r4786 r4873  
    5757my $arguments =
    5858    [ { 'name' => "metadata",
    59     'desc' => "Metadata field used for classification. List will be sorted by this element, unless -sort is used.",
     59    'desc' => "{Hierarchy.metadata}",
    6060    'type' => "metadata",
    6161    'reqd' => "yes" },
     62      { 'name' => "hfile",
     63    'desc' => "{Hierarchy.hfile}",
     64    'type' => "string",
     65    'deft' => "",
     66    'reqd' => "yes" },
    6267      { 'name' => "buttonname",
    63     'desc' => "Title field for this classification.",
     68    'desc' => "{Hierarchy.buttonname}",
    6469    'type' => "string",
    6570    'deft' => "Metadata element specified with -metadata",
    6671    'reqd' => "no" },
    67       { 'name' => "hfile",
    68     'desc' => "The classification structure file.",
    69     'type' => "string",
    70     'deft' => "",
    71     'reqd' => "yes" },
    7272      { 'name' => "sort",
    73     'desc' => "Metadata field to sort by. Use '-sort nosort' for no sorting.",
     73    'desc' => "{Hierarchy.sort}",
    7474    'type' => "string",
    7575    'deft' => "Metadata field specified with -metadata",
    7676    'reqd' => "no" },
    7777      { 'name' => "hlist_at_top",
    78     'desc' => "Display the first level of the classification horizontally.",
     78    'desc' => "{Hierarchy.hlist_at_top}",
    7979    'type' => "flag",
    8080    'reqd' => "no" } ];
     
    151151        if (!-e $subjectfile) {
    152152        my $outhandle = $self->{'outhandle'};
    153         $self->print_txt_usage();
     153        $self->print_txt_usage("");  # Use default resource bundle
    154154        print STDERR "\nHierarchy Error: Can't locate subject file $hfile\n";
    155155        print STDERR "This file should be in $collfile or $subjectfile\n";
     
    175175    if(defined $self->{'construction_error'} || !defined $self->{'metaname'} || !defined $self->{'subjectfile'}) {
    176176    print STDERR "Error: " , $self->{'construction_error'} , "\n";
    177     $self->print_txt_usage();
     177    $self->print_txt_usage("");  # Use default resource bundle
    178178    die "\n";
    179179    }
  • trunk/gsdl/perllib/classify/List.pm

    r4786 r4873  
    5151my $arguments =
    5252    [ { 'name' => "metadata",
    53     'desc' => "Metadata field used for classification. List will be sorted by this element.",
     53    'desc' => "{List.metadata}",
    5454    'type' => "metadata",
    55     'reqd' => "yes" } ,
     55    'reqd' => "yes" },
    5656      { 'name' => "buttonname",
    57     'desc' => "Button name for this classification.",
     57    'desc' => "{List.buttonname}",
    5858    'type' => "string",
    5959    'deft' => "Metadata element specified with -metadata",
    6060    'reqd' => "no" },
    6161      { 'name' => "sort",
    62     'desc' => "Metadata field to sort by. If not set, sorts in build (random) order.",
     62    'desc' => "{List.sort}",
    6363    'type' => "string",
    6464    'deft' => "Metadata field specified with -metadata",
     
    104104   
    105105    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    106     $self->print_txt_usage();
     106    $self->print_txt_usage("");  # Use default resource bundle
    107107    die "\n";
    108108    }
  • trunk/gsdl/perllib/classify/Phind.pm

    r4786 r4873  
    8585my $arguments =
    8686    [ { 'name' => "text",
    87     'desc' => "The text used to build the phrase hierarchy.",
     87    'desc' => "{Phind.text}",
    8888    'type' => "string",
    8989    'deft' => "section:Title,section:text",
    9090    'reqd' => "no" },
    9191      { 'name' => "title",
    92     'desc' => "The metadata field used to describe each document.",
     92    'desc' => "{Phind.title}",
    9393    'type' => "metadata",
    9494    'deft' => "Title",
    9595    'reqd' => "no" },
    9696      { 'name' => "button",
    97     'desc' => "The label for the classifier screen and button in navigation bar.",
     97    'desc' => "{Phind.button}",
    9898    'type' => "string",
    9999    'deft' => "Phrase",
    100100    'reqd' => "no" },
    101101      { 'name' => "language",
    102     'desc' => "Language or languages to use building hierarchy. Languages are identified by two-letter country codes like en (English), es (Spanish), and fr (French). Language is a regular expression, so 'en|fr' (English or French) and '..' (match any language) are valid.",
     102    'desc' => "{Phind.language}",
    103103    'type' => "language",
    104104    'deft' => "en",
    105105    'reqd' => "no" },
    106106      { 'name' => "savephrases",
    107     'desc' => "If set, the phrase infomation will be stored in the given file as text. It is probably a good idea to use an absolute path.",
     107    'desc' => "{Phind.savephrases}",
    108108    'type' => "string",
    109109    'deft' => "",
    110110    'reqd' => "no" },
    111111      { 'name' => "builddir",
    112     'desc' => "Where to put the built indexes.",
     112    'desc' => "{BasClas.builddir}",
    113113    'type' => "string",
    114114    'deft' => "" },
    115115      { 'name' => "suffixmode",
    116     'desc' => "The smode parameter to the phrase extraction program. A value of 0 means that stopwords are ignored, and of 1 means that stopwords are used.",
     116    'desc' => "{Phind.suffixmode}",
    117117    'type' => "int",
    118118    'deft' => "1",
    119119    'reqd' => "no" },
    120120      { 'name' => "thesaurus",
    121     'desc' => "Name of a thesaurus stored in Phind format in the collection's etc directory.",
     121    'desc' => "{Phind.thesaurus}",
    122122    'type' => "string",
    123123    'deft' => "",
    124124    'reqd' => "no" },
    125125      { 'name' => "untidy",
    126     'desc' => "Don't remove working files.",
     126    'desc' => "{Phind.untidy}",
    127127    'type' => "flag",
    128128    'reqd' => "no" } ];
     
    219219   
    220220    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    221     $self->print_txt_usage();
     221    $self->print_txt_usage("");  # Use default resource bundle
    222222    die "\n";
    223223    }
  • trunk/gsdl/perllib/classify/SectionList.pm

    r4786 r4873  
    3939}
    4040
    41 my $arguments =
    42     [ { 'name' => "metadata",
    43     'desc' => "Metadata field used for classification. List will be sorted by this element.",
    44     'type' => "metadata",
    45     'reqd' => "yes" } ,
    46       { 'name' => "buttonname",
    47     'desc' => "Button name for this classification.",
    48     'type' => "string",
    49     'deft' => "Metadata element specified with -metadata",
    50     'reqd' => "no" },
    51       { 'name' => "sort",
    52     'desc' => "Metadata field to sort by. If not set, sorts in build (random) order.",
    53     'type' => "string",
    54     'deft' => "Metadata field specified with -metadata",
    55     'reqd' => "no" } ];
    56 
    5741my $options = { 'name'     => "SectionList",
    5842        'desc'     => "Same as List classifier but includes all sections of document (excluding top level) rather than just top level document itself.",
    59         'inherits' => "Yes",
    60         'args'     => $arguments };
     43        'inherits' => "Yes" };
    6144
    6245#  sub print_usage {
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r4845 r4873  
    4545use printusage;
    4646
    47 my $unicode_list = 
     47my $unicode_list =
    4848    [ { 'name' => "auto",
    49     'desc' => "Use text categorization algorithm to automatically identify the encoding of each source document. This will be slower than explicitly setting the encoding but will work where more than one encoding is used within the same collection." } ,
     49    'desc' => "{BasPlug.input_encoding.auto}" },
    5050      { 'name' => "ascii",
    51     'desc' => "Plain 7 bit ascii. This may be a bit faster than using iso_8859_1. Beware of using this on a collection of documents that may contain characters outside the plain 7 bit ascii set though (e.g. German or French documents containing accents), use iso_8859_1 instead." },
     51    'desc' => "{BasPlug.input_encoding.ascii}" },
    5252      { 'name' => "utf8",
    53     'desc' => "either utf8 or unicode -- automatically detected." },
     53    'desc' => "{BasPlug.input_encoding.utf8}" },
    5454      { 'name' => "unicode",
    55     'desc' => "just unicode" } ];
    56 
    57 my $arguments = 
     55    'desc' => "{BasPlug.input_encoding.unicode}" } ];
     56
     57my $arguments =
    5858    [ { 'name' => "process_exp",
    59     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     59    'desc' => "{BasPlug.process_exp}",
    6060    'type' => "string",
    6161    'deft' => "",
    6262    'reqd' => "no" },
    6363      { 'name' => "block_exp",
    64     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
    65     'type' => 'string',
     64    'desc' => "{BasPlug.block_exp}",
     65    'type' => "string",
    6666    'deft' => "",
    6767    'reqd' => "no" },
    6868      { 'name' => "input_encoding",
    69     'desc' => "The encoding of the source documents. Documents will be converted from these encodings and stored internally as utf8.",
     69    'desc' => "{BasPlug.input_encoding}",
    7070    'type' => "enum",
    7171    'list' => $unicode_list,
     
    7373    'deft' => "auto" } ,
    7474      { 'name' => "default_encoding",
    75     'desc' => "Use this encoding if -input_encoding is set to 'auto' and the text categorization algorithm fails to extract the encoding or extracts an encoding unsupported by Greenstone.",
     75    'desc' => "{BasPlug.default_encoding}",
    7676    'type' => "enum",
    7777    'reqd' => "no",
    7878        'deft' => "utf8" },
    7979      { 'name' => "extract_language",
    80     'desc' => "Identify the language of each document and set 'Language' metadata. Note that this will be done automatically if -input_encoding is 'auto'.",
     80    'desc' => "{BasPlug.extract_language}",
    8181    'type' => "flag",
    8282    'reqd' => "no" },
    8383      { 'name' => "default_language",
    84     'desc' => "If Greenstone fails to work out what language a document is the 'Language' metadata element will be set to this value. The default is 'en' (ISO 639 language symbols are used: en = English). Note that if -input_encoding is not set to 'auto' and -extract_language is not set, all documents will have their 'Language' metadata set to this value.",
     84    'desc' => "{BasPlug.default_language}",
    8585    'type' => "language",
    8686    'deft' => "en",
    8787    'reqd' => "no" },
    8888      { 'name' => "extract_acronyms",
    89     'desc' => "Extract acronyms from within text and set as metadata.",
     89    'desc' => "{BasPlug.extract_acronyms}",
    9090    'type' => "flag",
    9191    'reqd' => "no" },
    9292      { 'name' => "markup_acronyms",
    93     'desc' => "Add acronym metadata into document text.",
     93    'desc' => "{BasPlug.markup_acronyms}",
    9494    'type' => "flag",
    9595    'reqd' => "no" },
    9696      { 'name' => "first",
    97     'desc' => "Comma separated list of first sizes to extract from the text into a metadata field. The field is called 'FirstNNN'.",
     97    'desc' => "{BasPlug.first}",
    9898    'type' => "string",
    9999    'reqd' => "no" },
    100100      { 'name' => "extract_email",
    101     'desc' => "Extract email addresses as metadata.",
     101    'desc' => "{BasPlug.extract_email}",
    102102    'type' => "flag",
    103103    'reqd' => "no" },
    104104      { 'name' => "extract_historical_years",
    105     'desc' => "Extract time-period information from historical documents.  This is stored as metadata with the document. There is a search interface for this metadata, which you can include in your collection by adding the statement, \"format QueryInterface DateSearch\" to your collection configuration file.",
     105    'desc' => "{BasPlug.extract_historical_years}",
    106106    'type' => "flag",
    107107    'reqd' => "no" },
    108108      { 'name' => "maximum_year",
    109     'desc' => "The maximum historical date to be used as metadata (in a Common Era date, such as 1950).",
     109    'desc' => "{BasPlug.maximum_year}",
    110110    'type' => "int",
    111111    'deft' => (localtime)[5]+1900,
    112112    'reqd' => "no"},
    113113      { 'name' => "maximum_century",
    114     'desc' => "The maximum named century to be extracted as historical metadata (e.g. 14 will extract all references up to the 14th century).",
     114    'desc' => "{BasPlug.maximum_century}",
    115115    'type' => "int",
    116116    'deft' => "-1",
    117117    'reqd' => "no" },
    118118      { 'name' => "no_bibliography",
    119     'desc' => "Do not try to block bibliographic dates when extracting historical dates.",
     119    'desc' => "{BasPlug.no_bibliography}",
    120120    'type' => "flag",
    121121    'reqd' => "no"},
    122122      { 'name' => "cover_image",
    123     'desc' => "Will look for a prefix.jpg file (where prefix is the same prefix as the file being processed) and associate it as a cover image.",
     123    'desc' => "{BasPlug.cover_image}",
    124124    'type' => "flag",
    125125    'reqd' => "no" } ];
     
    131131
    132132
     133sub get_arguments
     134{
     135    local $self = shift(@_);
     136    local $optionlistref = $self->{'option_list'};
     137    local @optionlist = @$optionlistref;
     138    local $pluginoptions = pop(@$optionlistref);
     139    local $pluginarguments = $pluginoptions->{'args'};
     140    return $pluginarguments;
     141}
     142
     143
    133144sub print_xml_usage
    134145{
    135146    local $self = shift(@_);
    136 
    137     print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
    138     $self->print_xml();
     147    local $language = shift(@_);
     148
     149    &PrintUsage::print_xml_header();
     150    $self->print_xml($language);
    139151}
    140152
     
    143155{
    144156    local $self = shift(@_);
     157    local $language = shift(@_);
    145158
    146159    local $optionlistref = $self->{'option_list'};
     
    155168    print STDERR "  <Arguments>\n";
    156169    if (defined($pluginoptions->{'args'})) {
    157     &PrintUsage::print_options_xml($pluginoptions->{'args'});
     170    &PrintUsage::print_options_xml($language, $pluginoptions->{'args'});
    158171    }
    159172
    160173    # Recurse up the plugin hierarchy
    161     $self->print_xml();
     174    $self->print_xml($language);
    162175
    163176    print STDERR "  </Arguments>\n";
     
    169182{
    170183    local $self = shift(@_);
     184    local $language = shift(@_);
    171185
    172186    # Print the usage message for a plugin (recursively)
    173187    local $descoffset = $self->determine_description_offset(0);
    174     $self->print_plugin_usage($descoffset, 1);
     188    $self->print_plugin_usage($language, $descoffset, 1);
    175189}
    176190
     
    205219{
    206220    local $self = shift(@_);
     221    local $language = shift(@_);
    207222    local $descoffset = shift(@_);
    208223    local $isleafclass = shift(@_);
     
    234249
    235250    # Display the plugin options
    236     &PrintUsage::print_options_txt($pluginargs, $optiondescoffset);
     251    &PrintUsage::print_options_txt($language, $pluginargs, $optiondescoffset);
    237252    }
    238253
    239254    # Recurse up the plugin hierarchy
    240     $self->print_plugin_usage($descoffset, 0);
     255    $self->print_plugin_usage($language, $descoffset, 0);
    241256    $self->{'option_list'} = \@optionlist;
    242257}
     
    380395    print STDERR "\nThe $plugin_name plugin uses an incorrect general option (general options are those\n";
    381396    print STDERR "available to all plugins). Check your collect.cfg configuration file.\n";
    382         # &print_general_usage($plugin_name);
    383     $self->print_txt_usage();
     397    $self->print_txt_usage("");  # Use default resource bundle
    384398    die "\n";
    385399    }
  • trunk/gsdl/perllib/plugins/BibTexPlug.pm

    r4792 r4873  
    5353my $arguments =
    5454    [ { 'name' => "process_exp",
    55     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     55    'desc' => "{BasPlug.process_exp}",
    5656    'type' => "string",
    57     'reqd' => "no" ,
    58     'deft' => q^(?i)\.bib$^ } ];
     57    'reqd' => "no",
     58    'deft' => &get_default_process_exp() } ];
    5959
    6060my $options = { 'name'     => "BibTexPlug",
  • trunk/gsdl/perllib/plugins/BookPlug.pm

    r4744 r4873  
    6262my $arguments =
    6363    [ { 'name' => "process_exp",
    64     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     64    'desc' => "{BasPlug.process_exp}",
    6565    'type' => "string",
    6666    'reqd' => "no",
    6767    'deft' => &get_default_process_exp() },
    6868      { 'name' => "block_exp",
    69     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     69    'desc' => "{BasPlug.block_exp}",
    7070    'type' => "string",
    7171    'reqd' => "no",
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r4842 r4873  
    5151my $convert_to_list =
    5252    [ { 'name' => "html",
    53     'desc' => "HTML format" },
     53    'desc' => "{ConvertToPlug.convert_to.html}" },
    5454      { 'name' => "text",
    55     'desc' => "Plain text format" } ];
    56 
    57 my $arguments = 
     55    'desc' => "{ConvertToPlug.convert_to.text}" } ];
     56
     57my $arguments =
    5858    [ { 'name' => "convert_to",
    59     'desc' => "Plugin converts to TEXT or HTML.",
     59    'desc' => "{ConvertToPlug.convert_to}",
    6060    'type' => "enum",
    6161    'reqd' => "no",
     
    6363    'deft' => "html" },
    6464      { 'name' => "use_strings",
    65     'desc' => "If set, a simple strings function will be called to extract text if the conversion utility fails.",
     65    'desc' => "{ConvertToPlug.use_strings}",
    6666    'type' => "flag",
    6767    'reqd' => "no" } ];
  • trunk/gsdl/perllib/plugins/DBPlug.pm

    r4844 r4873  
    4646my $arguments =
    4747    [ { 'name' => "process_exp",
    48     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     48    'desc' => "{BasPlug.process_exp}",
    4949    'type' => "string",
    5050    'deft' => &get_default_process_exp(),
     
    6565    # no plugin-specific options
    6666#    if (!parsargv::parse(\@_, "allow_extra_options")) {
    67 #   $self->print_txt_usage();
     67#   $self->print_txt_usage("");  # Use default resource bundle
    6868#   die "\n";
    6969#    }
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r4785 r4873  
    9090my $arguments =
    9191    [ { 'name' => "process_exp",
    92     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     92    'desc' => "{BasPlug.process_exp}",
    9393    'type' => "string",
    9494    'reqd' => "no",
    9595    'deft' => &get_default_process_exp() },
    9696      { 'name' => "no_attachments",
    97     'desc' => "Do not save message attachments.",
     97    'desc' => "{EMAILPlug.no_attachments}",
    9898    'type' => "flag",
    9999    'reqd' => "no" },
    100100      { 'name' => "split_exp",
    101     'desc' => "A perl regular expression used to split files containing many messages into individual documents.",
     101    'desc' => "{EMAILPlug.split_exp}",
    102102    'type' => "string",
    103103    'deft' => "" } ];
     
    126126    print STDERR "\nIncorrect options passed to $class.";
    127127    print STDERR "\nCheck your collect.cfg configuration file\n";
    128     $self->print_txt_usage();
     128    $self->print_txt_usage("");  # Use default resource bundle
    129129    die "\n";
    130130    }
  • trunk/gsdl/perllib/plugins/HTMLPlug.pm

    r4845 r4873  
    5050my $arguments =
    5151    [ { 'name' => "process_exp",
    52     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin.  For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     52    'desc' => "{BasPlug.process_exp}",
    5353    'type' => "string",
    5454    'deft' =>  &get_default_process_exp() },
    5555      { 'name' => "block_exp",
    56     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     56    'desc' => "{BasPlug.block_exp}",
    5757    'type' => 'string',
    5858    'deft' =>  &get_default_block_exp() },
    5959      { 'name' => "nolinks",
    60     'desc' =>  "Don't make any attempt to trap links (setting this flag may improve speed of building/importing but any relative links within documents will be broken).",
     60    'desc' => "{HTMLPlug.nolinks}",
    6161    'type' => "flag" },
    6262      { 'name' => "keep_head",
    63     'desc' => "Don't remove headers from html files.",
     63    'desc' => "{HTMLPlug.keep_head}",
    6464    'type' => "flag" },
    6565      { 'name' => "no_metadata",
    66     'desc' => "Don't attempt to extract any metadata from files.",
     66    'desc' => "{HTMLPlug.no_metadata}",
    6767    'type' => "flag" },
    6868      { 'name' => "metadata_fields",
    69     'desc' => "Comma separated list of metadata fields to attempt to extract. Use 'tag&lt;tagname&gt;' to have the contents of the first &lt;tagname&gt; pair put in a metadata element called 'tagname'. Capitalise this as you want the metadata capitalised in Greenstone, since the tag extraction is case insensitive.",
     69    'desc' => "{HTMLPlug.metadata_fields}",
    7070    'type' => "metadata",
    7171    'deft' => "Title" },
    7272      { 'name' => "hunt_creator_metadata",
    73     'desc' => "Find as much metadata as possible on authorship and place it in the 'Creator' field. Requires the -metadata_fields flag.",
     73    'desc' => "{HTMLPlug.hunt_creator_metadata}",
    7474    'type' => "flag" },
    7575      { 'name' => "file_is_url",
    76     'desc' => "Set if input filenames make up url of original source documents e.g. if a web mirroring tool was used to create the import directory structure.",
     76    'desc' => "{HTMLPlug.file_is_url}",
    7777    'type' => "flag" },
    7878      { 'name' => "assoc_files",
    79     'desc' => "Perl regular expression of file extensions to associate with html documents.",
     79    'desc' => "{HTMLPlug.assoc_files}",
    8080    'type' => "string",
    8181    'deft' => q^(?i)\.(jpe?g|gif|png|css)$^ },
    8282      { 'name' => "rename_assoc_files",
    83     'desc' => "Renames files associated with documents (e.g. images). Also creates much shallower directory structure (useful when creating collections to go on cd-rom).",
     83    'desc' => "{HTMLPlug.rename_assoc_files}",
    8484    'type' => "flag" },
    8585      { 'name' => "title_sub",
    86     'desc' => "Substitution expression to modify string stored as Title. Used by, for example, PDFPlug to remove \"Page 1\", etc from text used as the title.",
     86    'desc' => "{HTMLPlug.title_sub}",
    8787    'type' => "string",
    8888    'deft' => "" },
    8989      { 'name' => "description_tags",
    90     'desc' => "Split document into sub-sections where &lt;Section&gt; tags occur. Note that by setting this option you implicitly set -no_metadata, as all metadata should be included within the &lt;Section&gt; tags. Also, '-keep_head' will have no effect when this option is set.",
     90    'desc' => "{HTMLPlug.description_tags}",
    9191    'type' => "flag" } ];
    9292
     
    160160
    161161    print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    162     $self->print_txt_usage();
     162    $self->print_txt_usage("");  # Use default resource bundle
    163163    die "\n";
    164164    }
  • trunk/gsdl/perllib/plugins/ImagePlug.pm

    r4790 r4873  
    3434my $arguments =
    3535    [ { 'name' => "process_exp",
    36     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     36    'desc' => "{BasPlug.process_exp}",
    3737    'type' => "string",
    3838    'deft' => &get_default_process_exp(),
    3939    'reqd' => "no" },
    4040      { 'name' => "noscaleup",
    41     'desc' => "Don't scale up small images when making thumbnails.",
     41    'desc' => "{ImagePlug.noscaleup}",
    4242    'type' => "flag",
    4343    'reqd' => "no" },
    4444      { 'name' => "thumbnailsize",
    45     'desc' => "Make thumbnails of size nxn.",
     45    'desc' => "{ImagePlug.thumbnailsize}",
    4646    'type' => "int",
    4747    'deft' => "100",
    4848    'reqd' => "no" },
    4949      { 'name' => "thumbnailtype",
    50     'desc' => "Make thumbnails in format 's'.",
     50    'desc' => "{ImagePlug.thumbnailtype}",
    5151    'type' => "string",
    5252    'deft' => "gif",
    5353    'reqd' => "no" },
    5454      { 'name' => "screenviewsize",
    55     'desc' => "If set, makes an image of size n for screen display and sets Screen, ScreenSize, ScreenWidth and ScreenHeight metadata.  By default it is not set.",
     55    'desc' => "{ImagePlug.screenviewsize}",
    5656    'type' => "int",
    5757    'deft' => "0",
    5858    'reqd' => "no" },
    5959      { 'name' => "screenviewtype",
    60     'desc' => "If -screenviewsize is set, this sets the screen display image type.",
     60    'desc' => "{ImagePlug.screenviewtype}",
    6161    'type' => "string",
    6262    'deft' => "jpg",
    6363    'reqd' => "no" },
    6464      { 'name' => "converttotype",
    65     'desc' => "Convert main image to.",
     65    'desc' => "{ImagePlug.converttotype}",
    6666    'type' => "string",
    6767    'deft' => "",
    6868    'reqd' => "no" },
    6969      { 'name' => "minimumsize",
    70     'desc' => "Ignore images smaller than n bytes.",
     70    'desc' => "{ImagePlug.minimumsize}",
    7171    'type' => "int",
    7272    'deft' => "100",
     
    127127    print STDERR "\nImagePlug uses an incorrect option.\n";
    128128    print STDERR "Check your collect.cfg configuration file.\n";
    129     $self->print_txt_usage();
     129    $self->print_txt_usage("");  # Use default resource bundle
    130130    die "\n";
    131131    }
  • trunk/gsdl/perllib/plugins/MACROPlug.pm

    r4785 r4873  
    3636my $arguments =
    3737    [ { 'name' => "process_exp",
    38     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     38    'desc' => "{BasPlug.process_exp}",
    3939    'type' => "string",
    4040    'deft' => &get_default_process_exp(),
  • trunk/gsdl/perllib/plugins/MARCPlug.pm

    r4791 r4873  
    4040my $arguments =
    4141    [ { 'name' => "metadata_mapping",
    42     'desc' => "Name of file that includes mapping details from MARC values to Greenstone metadata names. Defaults to 'marctodc.txt' found in the site's etc directory.",
     42    'desc' => "{MARCPlug.metadata_mapping}",
    4343    'type' => "string",
    4444    'deft' => "marctodc.txt",
     
    4646
    4747my $options = { 'name'     => "MARCPlug",
    48         'desc'     => "",
     48        'desc'     => "Basic MARC plugin.",
    4949        'inherits' => "Yes",
    5050        'args'     => $arguments };
     
    7373
    7474    print STDERR "\nIncorrect options passed to MARCPlug, check your collect.cfg configuration file\n";
    75     $self->print_txt_usage();
     75    $self->print_txt_usage("");  # Use default resource bundle
    7676    die "\n";
    7777    }
  • trunk/gsdl/perllib/plugins/OAIPlug.pm

    r4785 r4873  
    4949    my $self = new BasPlug ($class, @_);
    5050
     51    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     52    my $option_list = $self->{'option_list'};
     53    push( @{$option_list}, $options );
     54
    5155    if (!parsargv::parse(\@_,
    5256             "allow_extra_options")) {
    5357
    5458    print STDERR "\nIncorrect options passed to OAIPlug, check your collect.cfg configuration file\n";
    55     $self->print_txt_usage();
     59    $self->print_txt_usage("");  # Use default resource bundle
    5660    die "\n";
    5761    }
  • trunk/gsdl/perllib/plugins/PDFPlug.pm

    r4785 r4873  
    3434my $arguments =
    3535    [ { 'name' => "process_exp",
    36     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     36    'desc' => "{BasPlug.process_exp}",
    3737    'type' => "string",
    3838    'deft' => &get_default_process_exp(),
    3939    'reqd' => "no" },
    4040      { 'name' => "block_exp",
    41     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     41    'desc' => "{BasPlug.block_exp}",
    4242    'type' => "string",
    43     'deft' =>  q^^ },
     43    'deft' => &get_default_block_exp() },
    4444      { 'name' => "noimages",
    45     'desc' => "Don't attempt to extract images from PDF.",
     45    'desc' => "{PDFPlug.noimages}",
    4646    'type' => "flag" },
    4747      { 'name' => "complex",
    48     'desc' => "Create more complex output. With this option set the output html will look much more like the original PDF file. For this to function properly you Ghostscript installed (for *nix gs should be on your path while for windows you must have gswin32c.exe on your path).",
     48    'desc' => "{PDFPlug.complex}",
    4949    'type' => "flag" },
    5050      { 'name' => "nohidden",
    51     'desc' => "Prevent pdftohtml from attempting to extract hidden text. This is only useful if the -complex option is also set.",
     51    'desc' => "{PDFPlug.nohidden}",
    5252    'type' => "flag" },
    5353      { 'name' => "zoom",
    54     'desc' => "The factor by which to zoom the PDF for output (this is only useful if -complex is set).",
     54    'desc' => "{PDFPlug.zoom}",
    5555    'deft' => "2",
    5656    'type' => "int" },
    5757      { 'name' => "use_sections",
    58     'desc' => "Create a separate section for each page of the PDF file.",
     58    'desc' => "{PDFPlug.use_sections}",
    5959    'type' => "flag" } ];
    6060
     
    7979    print STDERR "\nIncorrect options passed to PDFPlug, check your collect.cfg configuration file\n";
    8080    local $self = new ConvertToPlug($class, @_, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
    81     $self->print_txt_usage();
     81    $self->print_txt_usage("");  # Use default resource bundle
    8282    die "\n";
    8383    }
  • trunk/gsdl/perllib/plugins/PSPlug.pm

    r4785 r4873  
    3737my $arguments =
    3838    [ { 'name' => "process_exp",
    39     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     39    'desc' => "{BasPlug.process_exp}",
    4040    'type' => "string",
    4141    'deft' => &get_default_process_exp(),
    4242    'reqd' => "no" },
    4343      { 'name' => "block_exp",
    44     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     44    'desc' => "{BasPlug.block_exp}",
    4545    'type' => 'string',
    4646    'deft' => &get_default_block_exp() },
    4747      { 'name' => "extract_date",
    48     'desc' => "Extract date from PS header.",
     48    'desc' => "{PSPlug.extract_date}",
    4949    'type' => "flag" },
    5050      { 'name' => "extract_pages",
    51     'desc' => "Extract pages from PS header.",
     51    'desc' => "{PSPlug.extract_pages}",
    5252    'type' => "flag" },
    5353      { 'name' => "extract_title",
    54     'desc' => "Extract title from PS header.",
     54    'desc' => "{PSPlug.extract_title}",
    5555    'type' => "flag" } ];
    5656
    5757my $options = { 'name'     => "PSPlug",
    58         'desc'     => "This might look VERY similar to the PDF plugin.",
     58        'desc'     => "This is a \"poor man's\" ps to text converter. If you are serious, consider using the PRESCRIPT package, which is available for download at http://www.nzdl.org/html/software.html",
    5959        'inherits' => "yes",
    6060        'args'     => $arguments };
     
    7777             "allow_extra_options")) {
    7878    print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    79     $self->print_txt_usage();
     79    $self->print_txt_usage("");  # Use default resource bundle
    8080    die "\n";
    8181    }
  • trunk/gsdl/perllib/plugins/RTFPlug.pm

    r4744 r4873  
    3737my $arguments =
    3838    [ { 'name' => "process_exp",
    39     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     39    'desc' => "{BasPlug.process_exp}",
    4040    'type' => "string",
    4141    'deft' => &get_default_process_exp(),
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r4785 r4873  
    108108my $arguments =
    109109    [ { 'name' => "block_exp",
    110     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     110    'desc' => "{BasPlug.block_exp}",
    111111    'type' => "string",
    112112    'deft' => &get_default_block_exp(),
    113113    'reqd' => "no" },
    114114      { 'name' => "use_metadata_files",
    115     'desc' => "Read metadata from metadata XML files.",
     115    'desc' => "{RecPlug.use_metadata_files}",
    116116    'type' => "flag",
    117117    'reqd' => "no" } ];
     
    149149    print STDERR "\nRecPlug uses an incorrect option.\n";
    150150    print STDERR "Check your collect.cfg configuration file.\n\n";
    151     $self->print_txt_usage();
     151    $self->print_txt_usage("");  # Use default resource bundle
    152152    die "\n";
    153153    }
  • trunk/gsdl/perllib/plugins/ReferPlug.pm

    r4744 r4873  
    7474my $arguments =
    7575    [ { 'name' => "process_exp",
    76     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     76    'desc' => "{BasPlug.process_exp}",
    7777    'type' => "string",
    7878    'deft' => &get_default_process_exp(),
  • trunk/gsdl/perllib/plugins/SRCPlug.pm

    r4785 r4873  
    4848my $arguments =
    4949    [ { 'name' => "process_exp",
    50     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     50    'desc' => "{BasPlug.process_exp}",
    5151    'type' => "string",
    5252    'deft' => &get_default_process_exp(),
    5353    'reqd' => "no" } ,
    5454      { 'name' => "block_exp",
    55     'desc' => "Files matching this regular expression will be blocked from being passed to any later plugins in the list. This has no real effect other than to prevent lots of warning messages about input files you don't care about. Each plugin might have a default block_exp. e.g. by default HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png or .css file extensions.",
     55    'desc' => "{BasPlug.block_exp}",
    5656    'type' => 'string',
    5757    'deft' => &get_default_block_exp(),
    58     'reqd' => "no" } ,
     58    'reqd' => "no" },
    5959      { 'name' => "remove_prefix",
    60     'desc' => "Remove this leading pattern from the filename (eg -remove_prefix /tmp/XX/src/). The default is to remove the whole path from the filename.",
     60    'desc' => "{SRCPlug.remove_prefix}",
    6161    'type' => 'string',
    62     'deft' => "",
     62    'deft' => "^.*[/\\]",
    6363    'reqd' => "no" } ];
    6464
     
    9494        print STDERR "\nIncorrect options passed to SRCPlug, ";
    9595        print STDERR "check your collect.cfg configuration file\n";
    96     $self->print_txt_usage();
     96    $self->print_txt_usage("");  # Use default resource bundle
    9797        die "\n";
    9898    }
  • trunk/gsdl/perllib/plugins/SplitPlug.pm

    r4744 r4873  
    5151my $arguments =
    5252    [ { 'name' => "split_exp",
    53     'desc' => "A perl regular expression to split input files into segments.",
     53    'desc' => "{SplitPlug.split_exp}",
    5454    'type' => "string",
    5555    'deft' => &get_default_split_exp(),
    56     'reqd' => "no" }
    57       ];
     56    'reqd' => "no" } ];
    5857
    5958my $options = { 'name'     => "SplitPlug",
  • trunk/gsdl/perllib/plugins/TEXTPlug.pm

    r4785 r4873  
    4141my $arguments =
    4242    [ { 'name' => "process_exp",
    43     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     43    'desc' => "{BasPlug.process_exp}",
    4444    'type' => "string",
    4545    'deft' => &get_default_process_exp(),
    4646    'reqd' => "no" } ,
    4747      { 'name' => "title_sub",
    48     'desc' => "Substitution expression to modify string stored as Title. Used by, for example, PSPlug to remove \"Page 1\" etc from text used as the title.",
     48    'desc' => "{TEXTPlug.title_sub}",
    4949    'type' => "string",
    5050    'deft' => "",
     
    7878             "allow_extra_options")) {
    7979    print STDERR "\nIncorrect options passed to TEXTPlug, check your collect.cfg configuration file\n";
    80     $self->print_txt_usage();
     80    $self->print_txt_usage("");  # Use default resource bundle
    8181        die "\n";
    8282    }
  • trunk/gsdl/perllib/plugins/UnknownPlug.pm

    r4785 r4873  
    6666my $arguments =
    6767    [ { 'name' => "assoc_field",
    68     'desc' => "Name of the metadata field that will hold the associated file's name.",
     68    'desc' => "{UnknownPlug.assoc_field}",
    6969    'type' => "string",
    7070    'deft' => "",
    7171    'reqd' => "no" } ,
    7272      { 'name' => "file_type",
    73     'desc' => "Mime type of the file (e.g. image/gif)",
     73    'desc' => "{UnknownPlug.file_type}",
    7474    'type' => "string",
    7575    'deft' => "",
     
    104104             "allow_extra_options")) {
    105105    print STDERR "\nIncorrect options passed to UnknownPlug, check your collect.cfg configuration file\n";
    106     $self->print_txt_usage();
     106    $self->print_txt_usage("");  # Use default resource bundle
    107107        die "\n";
    108108    }
  • trunk/gsdl/perllib/plugins/W3ImgPlug.pm

    r4785 r4873  
    125125my $aggressiveness_list =
    126126    [ { 'name' => "1",
    127     'desc' => "Filename, path, ALT text only." },
     127    'desc' => "{W3ImgPlug.aggressiveness.1}" },
    128128      { 'name' => "2",
    129     'desc' => "All of 1, plus caption where available." },
     129    'desc' => "{W3ImgPlug.aggressiveness.2}" },
    130130      { 'name' => "3",
    131     'desc' => "All of 2, plus near paragraphs where available." },
     131    'desc' => "{W3ImgPlug.aggressiveness.3}" },
    132132      { 'name' => "4",
    133     'desc' => "All of 3, plus previous headers (<h1>, <h2>...) where available." },
     133    'desc' => "{W3ImgPlug.aggressiveness.4}" },
    134134      { 'name' => "5",
    135     'desc' => "All of 4, plus textual references where available." },
     135    'desc' => "{W3ImgPlug.aggressiveness.5}" },
    136136      { 'name' => "6",
    137     'desc' => "All of 4, plus page metatags (title, keywords, etc)." },
     137    'desc' => "{W3ImgPlug.aggressiveness.6}" },
    138138      { 'name' => "7",
    139     'desc' => "All of 6, 5 and 4 combined." },
     139    'desc' => "{W3ImgPlug.aggressiveness.7}" },
    140140      { 'name' => "8",
    141     'desc' => "All of 7, plus repeat caption, filename, etc (raise ranking of more relevant results)." },
     141    'desc' => "{W3ImgPlug.aggressiveness.8}" },
    142142      { 'name' => "9",
    143     'desc' => "All of 1, plus full text of source page." } ];
     143    'desc' => "{W3ImgPlug.aggressiveness.9}" } ];
    144144
    145145my $arguments =
    146146    [ { 'name' => "aggressiveness",
    147     'desc' => "Range of related text extraction techniques to use.",
     147    'desc' => "{W3ImgPlug.aggressiveness}",
    148148    'type' => "int",
    149149    'list' => $aggressiveness_list,
     
    151151    'reqd' => "no" },
    152152      { 'name' => "index_pages",
    153     'desc' => "Index the pages along with the images. Otherwise reference the pages at the source URL.",
     153    'desc' => "{W3ImgPlug.index_pages}",
    154154    'type' => "flag",
    155155    'reqd' => "no" },
    156156      { 'name' => "no_cache_images",
    157     'desc' => "Don't cache images (point to URL of original)",
     157    'desc' => "{W3ImgPlug.no_cache_images}",
    158158    'type' => "flag",
    159159    'reqd' => "no" },
    160160      { 'name' => "min_size",
    161     'desc' => "Bytes. Skip images smaller than this.",
     161    'desc' => "{W3ImgPlug.min_size}",
    162162    'type' => "int",
    163163    'deft' => "2000",
    164164    'reqd' => "no" },
    165165      { 'name' => "min_width",
    166     'desc' => "Pixels. Skip images narrower than this.",
     166    'desc' => "{W3ImgPlug.min_width}",
    167167    'type' => "int",
    168168    'deft' => "50",
    169169    'reqd' => "no" },
    170170      { 'name' => "min_height",
    171     'desc' => "Pixels. Skip images shorter than this.",
     171    'desc' => "{W3ImgPlug.min_height}",
    172172    'type' => "int",
    173173    'deft' => "50",
    174174    'reqd' => "no" },
    175175      { 'name' => "thumb_size",
    176     'desc' => "Max thumbnail size. Both width and height.",
     176    'desc' => "{W3ImgPlug.thumb_size}",
    177177    'type' => "int",
    178178    'deft' => "100",
    179179    'reqd' => "no" },
    180180      { 'name' => "convert_params",
    181     'desc' => "Additional parameters for ImageMagicK convert on thumbnail creation. For example, '-raise' will give a three dimensional effect to thumbnail images.",
     181    'desc' => "{W3ImgPlug.convert_params}",
    182182    'type' => "string",
    183183    'deft' => "",
    184184    'reqd' => "no" },
    185185      { 'name' => "min_near_text",
    186     'desc' => "Minimum characters of near text or caption to extract.",
     186    'desc' => "{W3ImgPlug.min_near_text}",
    187187    'type' => "int",
    188188    'deft' => "10",
    189189    'reqd' => "no" },
    190190      { 'name' => "max_near_text",
    191     'desc' => "Maximum characters near images to extract.",
     191    'desc' => "{W3ImgPlug.max_near_text}",
    192192    'type' => "int",
    193193    'deft' => "400",
    194194    'reqd' => "no" },
    195195      { 'name' => "smallpage_threshold",
    196     'desc' => "Images on pages smaller than this (bytes) will have the page (title, keywords, etc) meta-data added.",
     196    'desc' => "{W3ImgPlug.smallpage_threshold}",
    197197    'type' => "int",
    198198    'deft' => "2048",
    199199    'reqd' => "no" },
    200200      { 'name' => "textrefs_threshold",
    201     'desc' => "Threshold for textual references. Lower values mean the algorithm is less strict.",
     201    'desc' => "{W3ImgPlug.textrefs_threshold}",
    202202    'type' => "int",
    203203    'deft' => "2",
    204204    'reqd' => "no" },
    205205      { 'name' => "caption_length",
    206     'desc' => "Maximum length of captions (in characters).",
     206    'desc' => "{W3ImgPlug.caption_length}",
    207207    'type' => "int",
    208208    'deft' => "80",
    209209    'reqd' => "no" },
    210210      { 'name' => "neartext_length",
    211     'desc' => "Target length of near text (in characters).",
     211    'desc' => "{W3ImgPlug.neartext_length}",
    212212    'type' => "int",
    213213    'deft' => "300",
    214214    'reqd' => "no" },
    215215      { 'name' => "document_text",
    216     'desc' => "Add image text as document:text (otherwise IndexedText metadata field).",
     216    'desc' => "{W3ImgPlug.document_text}",
    217217    'type' => "flag",
    218     'reqd' => "no" }
    219       ];
     218    'reqd' => "no" } ];
    220219
    221220my $options = { 'name'     => "W3ImgPlug",
     
    301300
    302301    print STDERR "\nIncorrect options passed to W3ImgPlug, check your collect.cfg configuration file\n";
    303     $self->print_txt_usage();
     302    $self->print_txt_usage("");  # Use default resource bundle
    304303    die "\n";
    305304    }
  • trunk/gsdl/perllib/plugins/WordPlug.pm

    r4744 r4873  
    3636my $arguments =
    3737    [ { 'name' => "process_exp",
    38     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     38    'desc' => "{BasPlug.process_exp}",
    3939    'type' => "string",
    4040    'deft' => &get_default_process_exp(),
  • trunk/gsdl/perllib/plugins/XMLPlug.pm

    r4744 r4873  
    3838my $arguments =
    3939    [ { 'name' => "process_exp",
    40     'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. For example, using '(?i).html?\$' matches all documents ending in .htm or .html (case-insensitive).",
     40    'desc' => "{BasPlug.process_exp}",
    4141    'type' => "string",
    4242    'deft' => &get_default_process_exp(),
     
    5555    # $self is global for use within subroutines called by XML::Parser
    5656    $self = new BasPlug ($class, @_);
    57 
    5857
    5958    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
  • trunk/gsdl/perllib/printusage.pm

    r4777 r4873  
    4848sub print_options_xml
    4949{
     50    local $language = shift(@_);
    5051    local $options = shift(@_);
    5152
    5253    foreach $option (@$options) {
    5354    local $optionname = $option->{'name'};
     55    local $optiondesc = &lookup_string($language, $option->{'desc'});
     56
     57    # Escape '<' and '>' characters
     58    $optiondesc =~ s/</&lt;/g;
     59    $optiondesc =~ s/>/&gt;/g;
    5460
    5561    # Display option name, description and type
    5662    print STDERR "    <Option>\n";
    5763    print STDERR "      <Name>$optionname</Name>\n";
    58     print STDERR "      <Desc>$option->{'desc'}</Desc>\n";
     64    print STDERR "      <Desc>$optiondesc</Desc>\n";
    5965    print STDERR "      <Type>$option->{'type'}</Type>\n";
    6066
     
    7278        print STDERR "          <Name>$optionvalue->{'name'}</Name>\n";
    7379        if (defined $optionvalue->{'desc'}) {
    74             print STDERR "          <Desc>$optionvalue->{'desc'}</Desc>\n";
     80            local $optionvaluedesc = &lookup_string($language, $optionvalue->{'desc'});
     81
     82            # Escape '<' and '>' characters
     83            $optionvaluedesc =~ s/</&lt;/g;
     84            $optionvaluedesc =~ s/>/&gt;/g;
     85
     86            print STDERR "          <Desc>$optionvaluedesc</Desc>\n";
    7587        }
    7688        print STDERR "        </Value>\n";
     
    126138sub print_options_txt
    127139{
     140    local $language = shift(@_);
    128141    local $options = shift(@_);
    129142    local $optiondescoffset = shift(@_);
     
    143156
    144157    # Display the option description
    145     local $optiondesc = $option->{'desc'};
     158    local $optiondesc = &lookup_string($language, $option->{'desc'});
    146159    local $optionreqd = $option->{'reqd'};
    147160    if (defined($optionreqd) && $optionreqd eq "yes") {
     
    166179        print STDERR "$optionvaluename:";
    167180
    168         local $optionvaluedesc = $optionvalue->{'desc'};
     181        local $optionvaluedesc = &lookup_string($language, $optionvalue->{'desc'});
    169182        &display_text_in_column($optionvaluedesc, $optiondescoffset + 2,
    170183                    $optiondescoffset + length($optionvaluename), 80);
     
    191204
    192205
     206sub lookup_string
     207{
     208    local ($language, $stringkey) = @_;
     209
     210    # Load the appropriate resource bundle
     211    local %resourcebundle = &load_resource_bundle($language);
     212
     213    # Return the text matching the key (or just the key, if no match was found)
     214    return $resourcebundle{$stringkey} || $stringkey;
     215}
     216
     217
     218my $cachedlanguage = "<none>";
     219my %cachedresourcebundle = ();
     220
     221sub load_resource_bundle
     222{
     223    local $language = shift(@_);
     224
     225    # If the desired resource bundle is the one cached, return it
     226    if ($language eq $cachedlanguage) {
     227    return %cachedresourcebundle;
     228    }
     229
     230    # Open the appropriate resource bundle
     231    local $resourcebundlehome = &util::filename_cat("$ENV{'GSDLHOME'}", "perllib");
     232    local $resourcebundlename = "strings_" . $language . ".rb";
     233    local $resourcebundlefile = &util::filename_cat($resourcebundlehome, $resourcebundlename);
     234
     235    # If the specific resource bundle cannot be opened, use the generic (English) one
     236    if (!open(RESOURCE_BUNDLE, "<$resourcebundlefile")) {
     237    $resourcebundlename = "strings.rb";
     238    $resourcebundlefile = &util::filename_cat($resourcebundlehome, $resourcebundlename);
     239    open(RESOURCE_BUNDLE, "<$resourcebundlefile")
     240        or die "Error: Could not open generic resource bundle $resourcebundlefile.\n";
     241    }
     242
     243    local @resourcebundlelines = <RESOURCE_BUNDLE>;
     244    close(RESOURCE_BUNDLE);
     245
     246    # Load and cache this resource bundle
     247    $cachedlanguage = $language;
     248    %cachedresourcebundle = ();
     249    foreach $line (@resourcebundlelines) {
     250    # Remove any trailing whitespace
     251    $line =~ s/(\s*)$//;
     252
     253    # Ignore comments and empty lines
     254    if ($line !~ /^\#/ && $line ne "") {
     255        # Parse key (everything up to the first colon)
     256        $line =~ /^([^:]+):(.+)$/;
     257        local $linekey = "{" . $1 . "}";
     258        local $linetext = $2;
     259
     260        # Map key to text
     261        $cachedresourcebundle{$linekey} = $linetext;
     262    }
     263    }
     264
     265    return %cachedresourcebundle;
     266}
     267
     268
    193269sub display_text_in_column
    194270{
     
    211287
    212288    foreach $word (@words) {
    213     # Unescape '<' and '>' characters
    214     $word =~ s/&lt;/</g;
    215     $word =~ s/&gt;/>/g;
    216 
    217289    # If printing this word would exceed the column end, start a new line
    218290    if (($linelength + length($word)) >= $columnend) {
Note: See TracChangeset for help on using the changeset viewer.