hgbook

view tools/po4a/lib/Locale/Po4a/Chooser.pm @ 636:17fe2fe38373

Update Chinese translation
author Dongsheng Song <dongsheng.song@gmail.com>
date Mon Mar 16 16:52:31 2009 +0800 (2009-03-16)
parents
children
line source
1 # Locale::Po4a::Pod -- Convert POD data to PO file, for translation.
2 # $Id: Chooser.pm,v 1.41 2008-07-20 16:31:55 nekral-guest Exp $
3 #
4 # This program is free software; you may redistribute it and/or modify it
5 # under the terms of GPL (see COPYING).
6 #
7 # This module converts POD to PO file, so that it becomes possible to
8 # translate POD formatted documentation. See gettext documentation for
9 # more info about PO files.
11 ############################################################################
12 # Modules and declarations
13 ############################################################################
16 package Locale::Po4a::Chooser;
18 use 5.006;
19 use strict;
20 use warnings;
21 use Locale::Po4a::Common;
23 sub new {
24 my ($module)=shift;
25 my (%options)=@_;
27 die wrap_mod("po4a::chooser", gettext("Need to provide a module name"))
28 unless defined $module;
30 my $modname;
31 if ($module eq 'kernelhelp') {
32 $modname = 'KernelHelp';
33 } elsif ($module eq 'newsdebian') {
34 $modname = 'NewsDebian';
35 } elsif ($module eq 'latex') {
36 $modname = 'LaTeX';
37 } elsif ($module eq 'bibtex') {
38 $modname = 'BibTex';
39 } elsif ($module eq 'tex') {
40 $modname = 'TeX';
41 } else {
42 $modname = ucfirst($module);
43 }
44 if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) {
45 eval qq{use Locale::Po4a::$modname};
46 if ($@) {
47 my $error=$@;
48 warn wrap_msg(gettext("Unknown format type: %s."), $module);
49 warn wrap_mod("po4a::chooser",
50 gettext("Module loading error: %s"), $error)
51 if defined $options{'verbose'} && $options{'verbose'} > 0;
52 list(1);
53 }
54 }
55 return "Locale::Po4a::$modname"->new(%options);
56 }
58 sub list {
59 warn wrap_msg(gettext("List of valid formats:")
60 # ."\n - ".gettext("bibtex: BibTex bibliography format.")
61 ."\n - ".gettext("dia: uncompressed Dia diagrams.")
62 ."\n - ".gettext("docbook: Docbook XML.")
63 ."\n - ".gettext("guide: Gentoo Linux's xml documentation format.")
64 # ."\n - ".gettext("html: HTML documents (EXPERIMENTAL).")
65 ."\n - ".gettext("ini: .INI format.")
66 ."\n - ".gettext("kernelhelp: Help messages of each kernel compilation option.")
67 ."\n - ".gettext("latex: LaTeX format.")
68 ."\n - ".gettext("man: Good old manual page format.")
69 ."\n - ".gettext("pod: Perl Online Documentation format.")
70 ."\n - ".gettext("sgml: either debiandoc or docbook DTD.")
71 ."\n - ".gettext("texinfo: The info page format.")
72 ."\n - ".gettext("tex: generic TeX documents (see also latex).")
73 ."\n - ".gettext("text: simple text document.")
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 ##############################################################################
84 1;
85 __END__
87 =head1 NAME
89 Locale::Po4a::Chooser - Manage po4a modules
91 =head1 DESCRIPTION
93 Locale::Po4a::Chooser is a module to manage po4a modules. Before, all po4a
94 binaries used to know all po4a modules (pod, man, sgml, etc). This made the
95 add of a new module boring, to make sure the documentation is synchronized
96 in all modules, and that each of them can access the new module.
98 Now, you just have to call the Locale::Po4a::Chooser::new() function,
99 passing the name of module as argument.
101 You also have the Locale::Po4a::Chooser::list() function which lists the
102 available format and exits on the value passed as argument.
104 =head1 SEE ALSO
106 =over 4
108 =item About po4a:
110 L<po4a(7)|po4a.7>,
111 L<Locale::Po4a::TransTractor(3pm)>,
112 L<Locale::Po4a::Po(3pm)>
114 =item About modules:
116 L<Locale::Po4a::Dia(3pm)>,
117 L<Locale::Po4a::Docbook(3pm)>,
118 L<Locale::Po4a::Guide(3pm)>,
119 L<Locale::Po4a::Halibut(3pm)>,
120 L<Locale::Po4a::Ini(3pm)>,
121 L<Locale::Po4a::KernelHelp(3pm)>,
122 L<Locale::Po4a::LaTeX(3pm)>,
123 L<Locale::Po4a::Man(3pm)>,
124 L<Locale::Po4a::Pod(3pm)>,
125 L<Locale::Po4a::Sgml(3pm)>,
126 L<Locale::Po4a::TeX(3pm)>,
127 L<Locale::Po4a::Texinfo(3pm)>,
128 L<Locale::Po4a::Text(3pm)>,
129 L<Locale::Po4a::Wml(3pm)>.
130 L<Locale::Po4a::Xhtml(3pm)>,
131 L<Locale::Po4a::Xml(3pm)>,
132 L<Locale::Po4a::Wml(3pm)>.
134 =back
136 =head1 AUTHORS
138 Denis Barbier <barbier@linuxfr.org>
139 Martin Quinson (mquinson#debian.org)
141 =head1 COPYRIGHT AND LICENSE
143 Copyright 2002,2003,2004,2005 by SPI, inc.
145 This program is free software; you may redistribute it and/or modify it
146 under the terms of GPL (see the COPYING file).
148 =cut