Chameleon

Chameleon Svn Source Tree

Root/branches/Bungo/package/bin/po4a/lib/Locale/Po4a/Chooser.pm

1# Locale::Po4a::Chooser -- Manage po4a modules
2#
3# This program is free software; you may redistribute it and/or modify it
4# under the terms of GPL (see COPYING).
5#
6# This module converts POD to PO file, so that it becomes possible to
7# translate POD formatted documentation. See gettext documentation for
8# more info about PO files.
9
10############################################################################
11# Modules and declarations
12############################################################################
13
14
15package Locale::Po4a::Chooser;
16
17use 5.006;
18use strict;
19use warnings;
20use Locale::Po4a::Common;
21
22sub new {
23 my ($module)=shift;
24 my (%options)=@_;
25
26 die wrap_mod("po4a::chooser", gettext("Need to provide a module name"))
27 unless defined $module;
28
29 my $modname;
30 if ($module eq 'kernelhelp') {
31 $modname = 'KernelHelp';
32 } elsif ($module eq 'newsdebian') {
33 $modname = 'NewsDebian';
34 } elsif ($module eq 'latex') {
35 $modname = 'LaTeX';
36 } elsif ($module eq 'bibtex') {
37 $modname = 'BibTex';
38 } elsif ($module eq 'tex') {
39 $modname = 'TeX';
40 } else {
41 $modname = ucfirst($module);
42 }
43 if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) {
44 eval qq{use Locale::Po4a::$modname};
45 if ($@) {
46 my $error=$@;
47 warn wrap_msg(gettext("Unknown format type: %s."), $module);
48 warn wrap_mod("po4a::chooser",
49 gettext("Module loading error: %s"), $error)
50 if defined $options{'verbose'} && $options{'verbose'} > 0;
51 list(1);
52 }
53 }
54 return "Locale::Po4a::$modname"->new(%options);
55}
56
57sub list {
58 warn wrap_msg(gettext("List of valid formats:")
59#."\n - ".gettext("bibtex: BibTex bibliography format.")
60."\n - ".gettext("dia: uncompressed Dia diagrams.")
61."\n - ".gettext("docbook: DocBook XML.")
62."\n - ".gettext("guide: Gentoo Linux's XML documentation format.")
63#."\n - ".gettext("html: HTML documents (EXPERIMENTAL).")
64."\n - ".gettext("ini: INI format.")
65."\n - ".gettext("kernelhelp: Help messages of each kernel compilation option.")
66."\n - ".gettext("latex: LaTeX format.")
67."\n - ".gettext("man: Good old manual page format.")
68."\n - ".gettext("pod: Perl Online Documentation format.")
69."\n - ".gettext("sgml: either DebianDoc or DocBook DTD.")
70."\n - ".gettext("texinfo: The info page format.")
71."\n - ".gettext("tex: generic TeX documents (see also latex).")
72."\n - ".gettext("text: simple text document.")
73."\n - ".gettext("prop: Java property and OSX/NeXTSTEP strings files.")
74."\n - ".gettext("wml: WML documents.")
75."\n - ".gettext("xhtml: XHTML documents.")
76."\n - ".gettext("xml: generic XML documents (see also docbook).")
77 );
78 exit shift;
79}
80##############################################################################
81# Module return value and documentation
82##############################################################################
83
841;
85__END__
86
87=encoding UTF-8
88
89=head1 NAME
90
91Locale::Po4a::Chooser - manage po4a modules
92
93=head1 DESCRIPTION
94
95Locale::Po4a::Chooser is a module to manage po4a modules. Previously, all po4a
96binaries used to know all po4a modules (pod, man, sgml, etc). This made the
97addition of a new module boring, to make sure the documentation is synchronized
98in all modules, and that each of them can access the new module.
99
100Now, you just have to call the Locale::Po4a::Chooser::new() function,
101passing the name of module as argument.
102
103You also have the Locale::Po4a::Chooser::list() function which lists the
104available formats and exits on the value passed as argument.
105
106=head1 SEE ALSO
107
108=over 4
109
110=item About po4a:
111
112L<Locale::Po4a::Po(3pm)>,
113L<Locale::Po4a::TransTractor(3pm)>,
114L<po4a(7)|po4a.7>
115
116=item About modules:
117
118L<Locale::Po4a::Dia(3pm)>,
119L<Locale::Po4a::Docbook(3pm)>,
120L<Locale::Po4a::Guide(3pm)>,
121L<Locale::Po4a::Halibut(3pm)>,
122L<Locale::Po4a::Ini(3pm)>,
123L<Locale::Po4a::KernelHelp(3pm)>,
124L<Locale::Po4a::LaTeX(3pm)>,
125L<Locale::Po4a::Man(3pm)>,
126L<Locale::Po4a::Pod(3pm)>,
127L<Locale::Po4a::Sgml(3pm)>,
128L<Locale::Po4a::TeX(3pm)>,
129L<Locale::Po4a::Texinfo(3pm)>,
130L<Locale::Po4a::Text(3pm)>,
131L<Locale::Po4a::Prop(3pm)>,
132L<Locale::Po4a::Wml(3pm)>.
133L<Locale::Po4a::Xhtml(3pm)>,
134L<Locale::Po4a::Xml(3pm)>,
135L<Locale::Po4a::Wml(3pm)>.
136
137=back
138
139=head1 AUTHORS
140
141 Denis Barbier <barbier@linuxfr.org>
142 Martin Quinson (mquinson#debian.org)
143
144=head1 COPYRIGHT AND LICENSE
145
146Copyright 2002,2003,2004,2005 by SPI, inc.
147
148This program is free software; you may redistribute it and/or modify it
149under the terms of GPL (see the COPYING file).
150
151=cut
152

Archive Download this file

Revision: 2469