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 | ␊ |
15 | package Locale::Po4a::Chooser;␊ |
16 | ␊ |
17 | use 5.006;␊ |
18 | use strict;␊ |
19 | use warnings;␊ |
20 | use Locale::Po4a::Common;␊ |
21 | ␊ |
22 | sub 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 | ␊ |
57 | sub 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 | ␊ |
84 | 1;␊ |
85 | __END__␊ |
86 | ␊ |
87 | =encoding UTF-8␊ |
88 | ␊ |
89 | =head1 NAME␊ |
90 | ␊ |
91 | Locale::Po4a::Chooser - manage po4a modules␊ |
92 | ␊ |
93 | =head1 DESCRIPTION␊ |
94 | ␊ |
95 | Locale::Po4a::Chooser is a module to manage po4a modules. Previously, all po4a␊ |
96 | binaries used to know all po4a modules (pod, man, sgml, etc). This made the␊ |
97 | addition of a new module boring, to make sure the documentation is synchronized␊ |
98 | in all modules, and that each of them can access the new module.␊ |
99 | ␊ |
100 | Now, you just have to call the Locale::Po4a::Chooser::new() function,␊ |
101 | passing the name of module as argument.␊ |
102 | ␊ |
103 | You also have the Locale::Po4a::Chooser::list() function which lists the␊ |
104 | available formats and exits on the value passed as argument.␊ |
105 | ␊ |
106 | =head1 SEE ALSO␊ |
107 | ␊ |
108 | =over 4␊ |
109 | ␊ |
110 | =item About po4a:␊ |
111 | ␊ |
112 | L<Locale::Po4a::Po(3pm)>,␊ |
113 | L<Locale::Po4a::TransTractor(3pm)>,␊ |
114 | L<po4a(7)|po4a.7>␊ |
115 | ␊ |
116 | =item About modules:␊ |
117 | ␊ |
118 | L<Locale::Po4a::Dia(3pm)>,␊ |
119 | L<Locale::Po4a::Docbook(3pm)>,␊ |
120 | L<Locale::Po4a::Guide(3pm)>,␊ |
121 | L<Locale::Po4a::Halibut(3pm)>,␊ |
122 | L<Locale::Po4a::Ini(3pm)>,␊ |
123 | L<Locale::Po4a::KernelHelp(3pm)>,␊ |
124 | L<Locale::Po4a::LaTeX(3pm)>,␊ |
125 | L<Locale::Po4a::Man(3pm)>,␊ |
126 | L<Locale::Po4a::Pod(3pm)>,␊ |
127 | L<Locale::Po4a::Sgml(3pm)>,␊ |
128 | L<Locale::Po4a::TeX(3pm)>,␊ |
129 | L<Locale::Po4a::Texinfo(3pm)>,␊ |
130 | L<Locale::Po4a::Text(3pm)>,␊ |
131 | L<Locale::Po4a::Prop(3pm)>,␊ |
132 | L<Locale::Po4a::Wml(3pm)>.␊ |
133 | L<Locale::Po4a::Xhtml(3pm)>,␊ |
134 | L<Locale::Po4a::Xml(3pm)>,␊ |
135 | L<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 | ␊ |
146 | Copyright 2002,2003,2004,2005 by SPI, inc.␊ |
147 | ␊ |
148 | This program is free software; you may redistribute it and/or modify it␊ |
149 | under the terms of GPL (see the COPYING file).␊ |
150 | ␊ |
151 | =cut␊ |
152 | |