hgbook

annotate tools/po4a/lib/Locale/Po4a/Chooser.pm @ 623:082bb76417f1

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