source: trunk/gsdl/perllib/plugins/RTFPlug.pm@ 5096

Last change on this file since 5096 was 4873, checked in by mdewsnip, 21 years ago

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).

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1###########################################################################
2#
3# RTFPlug.pm -- plugin for importing Rich Text Format files.
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 2001 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
27# 12/05/02 Added usage datastructure - John Thompson
28
29package RTFPlug;
30
31use ConvertToPlug;
32
33sub BEGIN {
34 @ISA = ('ConvertToPlug');
35}
36
37my $arguments =
38 [ { 'name' => "process_exp",
39 'desc' => "{BasPlug.process_exp}",
40 'type' => "string",
41 'deft' => &get_default_process_exp(),
42 'reqd' => "no" } ];
43
44my $options = { 'name' => "RTFPlug",
45 'desc' => "Plugin for importing Rich Text Format files.",
46 'inherits' => "yes",
47 'args' => $arguments };
48
49sub new {
50 my $class = shift (@_);
51 my $self = new ConvertToPlug ($class, @_);
52
53 # 14-05-02 To allow for proper inheritance of arguments - John Thompson
54 my $option_list = $self->{'option_list'};
55 push( @{$option_list}, $options );
56
57 return bless $self, $class;
58}
59
60sub get_default_process_exp {
61 my $self = shift (@_);
62 return q^(?i)\.rtf$^;
63}
64
65sub process {
66 my $self = shift (@_);
67
68 my $outhandle = $self->{'outhandle'};
69 print $outhandle "RTFPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
70 if $self->{'verbosity'} > 1;
71
72 return ConvertToPlug::process_type($self,"rtf",@_);
73}
74
751;
Note: See TracBrowser for help on using the repository browser.