dongsheng@623: # Locale::Po4a::Pod -- Convert POD data to PO file, for translation. dongsheng@623: # $Id: Chooser.pm,v 1.41 2008-07-20 16:31:55 nekral-guest Exp $ dongsheng@623: # dongsheng@623: # This program is free software; you may redistribute it and/or modify it dongsheng@623: # under the terms of GPL (see COPYING). dongsheng@623: # dongsheng@623: # This module converts POD to PO file, so that it becomes possible to dongsheng@623: # translate POD formatted documentation. See gettext documentation for dongsheng@623: # more info about PO files. dongsheng@623: dongsheng@623: ############################################################################ dongsheng@623: # Modules and declarations dongsheng@623: ############################################################################ dongsheng@623: dongsheng@623: dongsheng@623: package Locale::Po4a::Chooser; dongsheng@623: dongsheng@623: use 5.006; dongsheng@623: use strict; dongsheng@623: use warnings; dongsheng@623: use Locale::Po4a::Common; dongsheng@623: dongsheng@623: sub new { dongsheng@623: my ($module)=shift; dongsheng@623: my (%options)=@_; dongsheng@623: dongsheng@623: die wrap_mod("po4a::chooser", gettext("Need to provide a module name")) dongsheng@623: unless defined $module; dongsheng@623: dongsheng@623: my $modname; dongsheng@623: if ($module eq 'kernelhelp') { dongsheng@623: $modname = 'KernelHelp'; dongsheng@623: } elsif ($module eq 'newsdebian') { dongsheng@623: $modname = 'NewsDebian'; dongsheng@623: } elsif ($module eq 'latex') { dongsheng@623: $modname = 'LaTeX'; dongsheng@623: } elsif ($module eq 'bibtex') { dongsheng@623: $modname = 'BibTex'; dongsheng@623: } elsif ($module eq 'tex') { dongsheng@623: $modname = 'TeX'; dongsheng@623: } else { dongsheng@623: $modname = ucfirst($module); dongsheng@623: } dongsheng@623: if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) { dongsheng@623: eval qq{use Locale::Po4a::$modname}; dongsheng@623: if ($@) { dongsheng@623: my $error=$@; dongsheng@623: warn wrap_msg(gettext("Unknown format type: %s."), $module); dongsheng@623: warn wrap_mod("po4a::chooser", dongsheng@623: gettext("Module loading error: %s"), $error) dongsheng@623: if defined $options{'verbose'} && $options{'verbose'} > 0; dongsheng@623: list(1); dongsheng@623: } dongsheng@623: } dongsheng@623: return "Locale::Po4a::$modname"->new(%options); dongsheng@623: } dongsheng@623: dongsheng@623: sub list { dongsheng@623: warn wrap_msg(gettext("List of valid formats:") dongsheng@623: # ."\n - ".gettext("bibtex: BibTex bibliography format.") dongsheng@623: ."\n - ".gettext("dia: uncompressed Dia diagrams.") dongsheng@623: ."\n - ".gettext("docbook: Docbook XML.") dongsheng@623: ."\n - ".gettext("guide: Gentoo Linux's xml documentation format.") dongsheng@623: # ."\n - ".gettext("html: HTML documents (EXPERIMENTAL).") dongsheng@623: ."\n - ".gettext("ini: .INI format.") dongsheng@623: ."\n - ".gettext("kernelhelp: Help messages of each kernel compilation option.") dongsheng@623: ."\n - ".gettext("latex: LaTeX format.") dongsheng@623: ."\n - ".gettext("man: Good old manual page format.") dongsheng@623: ."\n - ".gettext("pod: Perl Online Documentation format.") dongsheng@623: ."\n - ".gettext("sgml: either debiandoc or docbook DTD.") dongsheng@623: ."\n - ".gettext("texinfo: The info page format.") dongsheng@623: ."\n - ".gettext("tex: generic TeX documents (see also latex).") dongsheng@623: ."\n - ".gettext("text: simple text document.") dongsheng@623: ."\n - ".gettext("wml: WML documents.") dongsheng@623: ."\n - ".gettext("xhtml: XHTML documents.") dongsheng@623: ."\n - ".gettext("xml: generic XML documents (see also docbook).") dongsheng@623: ); dongsheng@623: exit shift; dongsheng@623: } dongsheng@623: ############################################################################## dongsheng@623: # Module return value and documentation dongsheng@623: ############################################################################## dongsheng@623: dongsheng@623: 1; dongsheng@623: __END__ dongsheng@623: dongsheng@623: =head1 NAME dongsheng@623: dongsheng@623: Locale::Po4a::Chooser - Manage po4a modules dongsheng@623: dongsheng@623: =head1 DESCRIPTION dongsheng@623: dongsheng@623: Locale::Po4a::Chooser is a module to manage po4a modules. Before, all po4a dongsheng@623: binaries used to know all po4a modules (pod, man, sgml, etc). This made the dongsheng@623: add of a new module boring, to make sure the documentation is synchronized dongsheng@623: in all modules, and that each of them can access the new module. dongsheng@623: dongsheng@623: Now, you just have to call the Locale::Po4a::Chooser::new() function, dongsheng@623: passing the name of module as argument. dongsheng@623: dongsheng@623: You also have the Locale::Po4a::Chooser::list() function which lists the dongsheng@623: available format and exits on the value passed as argument. dongsheng@623: dongsheng@623: =head1 SEE ALSO dongsheng@623: dongsheng@623: =over 4 dongsheng@623: dongsheng@623: =item About po4a: dongsheng@623: dongsheng@623: L, dongsheng@623: L, dongsheng@623: L dongsheng@623: dongsheng@623: =item About modules: dongsheng@623: dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L, dongsheng@623: L. dongsheng@623: L, dongsheng@623: L, dongsheng@623: L. dongsheng@623: dongsheng@623: =back dongsheng@623: dongsheng@623: =head1 AUTHORS dongsheng@623: dongsheng@623: Denis Barbier dongsheng@623: Martin Quinson (mquinson#debian.org) dongsheng@623: dongsheng@623: =head1 COPYRIGHT AND LICENSE dongsheng@623: dongsheng@623: Copyright 2002,2003,2004,2005 by SPI, inc. dongsheng@623: dongsheng@623: This program is free software; you may redistribute it and/or modify it dongsheng@623: under the terms of GPL (see the COPYING file). dongsheng@623: dongsheng@623: =cut