hgbook

diff tools/po4a/lib/Locale/Po4a/Chooser.pm @ 653:6b1577ef5135

Update Chinese translation
author Dongsheng Song <dongsheng.song@gmail.com>
date Fri Mar 20 17:17:55 2009 +0800 (2009-03-20)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/po4a/lib/Locale/Po4a/Chooser.pm	Fri Mar 20 17:17:55 2009 +0800
     1.3 @@ -0,0 +1,148 @@
     1.4 +# Locale::Po4a::Pod -- Convert POD data to PO file, for translation.
     1.5 +# $Id: Chooser.pm,v 1.41 2008-07-20 16:31:55 nekral-guest Exp $
     1.6 +#
     1.7 +# This program is free software; you may redistribute it and/or modify it
     1.8 +# under the terms of GPL (see COPYING).
     1.9 +#
    1.10 +# This module converts POD to PO file, so that it becomes possible to 
    1.11 +# translate POD formatted documentation. See gettext documentation for
    1.12 +# more info about PO files.
    1.13 +
    1.14 +############################################################################
    1.15 +# Modules and declarations
    1.16 +############################################################################
    1.17 +
    1.18 +
    1.19 +package Locale::Po4a::Chooser;
    1.20 +
    1.21 +use 5.006;
    1.22 +use strict;
    1.23 +use warnings;
    1.24 +use Locale::Po4a::Common;
    1.25 +
    1.26 +sub new {
    1.27 +    my ($module)=shift;
    1.28 +    my (%options)=@_;
    1.29 +
    1.30 +    die wrap_mod("po4a::chooser", gettext("Need to provide a module name"))
    1.31 +      unless defined $module;
    1.32 +
    1.33 +    my $modname;
    1.34 +    if ($module eq 'kernelhelp') {
    1.35 +        $modname = 'KernelHelp';
    1.36 +    } elsif ($module eq 'newsdebian') {
    1.37 +        $modname = 'NewsDebian';
    1.38 +    } elsif ($module eq 'latex') {
    1.39 +        $modname = 'LaTeX';
    1.40 +    } elsif ($module eq 'bibtex') {
    1.41 +        $modname = 'BibTex';
    1.42 +    } elsif ($module eq 'tex') {
    1.43 +        $modname = 'TeX';
    1.44 +    } else {
    1.45 +        $modname = ucfirst($module);
    1.46 +    }
    1.47 +    if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) {
    1.48 +        eval qq{use Locale::Po4a::$modname};
    1.49 +        if ($@) {
    1.50 +            my $error=$@;
    1.51 +            warn wrap_msg(gettext("Unknown format type: %s."), $module);
    1.52 +	    warn wrap_mod("po4a::chooser",
    1.53 +		gettext("Module loading error: %s"), $error)
    1.54 +	      if defined $options{'verbose'} && $options{'verbose'} > 0;
    1.55 +            list(1);
    1.56 +        }
    1.57 +    }
    1.58 +    return "Locale::Po4a::$modname"->new(%options);
    1.59 +}
    1.60 +
    1.61 +sub list {
    1.62 +    warn wrap_msg(gettext("List of valid formats:")
    1.63 +#	."\n  - ".gettext("bibtex: BibTex bibliography format.")
    1.64 +	."\n  - ".gettext("dia: uncompressed Dia diagrams.")
    1.65 +	."\n  - ".gettext("docbook: Docbook XML.")
    1.66 +	."\n  - ".gettext("guide: Gentoo Linux's xml documentation format.")
    1.67 +#	."\n  - ".gettext("html: HTML documents (EXPERIMENTAL).")
    1.68 +	."\n  - ".gettext("ini: .INI format.")
    1.69 +	."\n  - ".gettext("kernelhelp: Help messages of each kernel compilation option.")
    1.70 +	."\n  - ".gettext("latex: LaTeX format.")
    1.71 +	."\n  - ".gettext("man: Good old manual page format.")
    1.72 +	."\n  - ".gettext("pod: Perl Online Documentation format.")
    1.73 +	."\n  - ".gettext("sgml: either debiandoc or docbook DTD.")
    1.74 +	."\n  - ".gettext("texinfo: The info page format.")
    1.75 +	."\n  - ".gettext("tex: generic TeX documents (see also latex).")
    1.76 +	."\n  - ".gettext("text: simple text document.")
    1.77 +	."\n  - ".gettext("wml: WML documents.")
    1.78 +	."\n  - ".gettext("xhtml: XHTML documents.")
    1.79 +	."\n  - ".gettext("xml: generic XML documents (see also docbook).")
    1.80 +    );
    1.81 +    exit shift;
    1.82 +}
    1.83 +##############################################################################
    1.84 +# Module return value and documentation
    1.85 +##############################################################################
    1.86 +
    1.87 +1;
    1.88 +__END__
    1.89 +
    1.90 +=head1 NAME
    1.91 +
    1.92 +Locale::Po4a::Chooser - Manage po4a modules
    1.93 +
    1.94 +=head1 DESCRIPTION
    1.95 +
    1.96 +Locale::Po4a::Chooser is a module to manage po4a modules. Before, all po4a
    1.97 +binaries used to know all po4a modules (pod, man, sgml, etc). This made the
    1.98 +add of a new module boring, to make sure the documentation is synchronized
    1.99 +in all modules, and that each of them can access the new module.
   1.100 +
   1.101 +Now, you just have to call the Locale::Po4a::Chooser::new() function,
   1.102 +passing the name of module as argument.
   1.103 +
   1.104 +You also have the Locale::Po4a::Chooser::list() function which lists the
   1.105 +available format and exits on the value passed as argument.
   1.106 +
   1.107 +=head1 SEE ALSO
   1.108 +
   1.109 +=over 4
   1.110 +
   1.111 +=item About po4a:
   1.112 +
   1.113 +L<po4a(7)|po4a.7>, 
   1.114 +L<Locale::Po4a::TransTractor(3pm)>,
   1.115 +L<Locale::Po4a::Po(3pm)>
   1.116 +
   1.117 +=item About modules:
   1.118 +
   1.119 +L<Locale::Po4a::Dia(3pm)>,
   1.120 +L<Locale::Po4a::Docbook(3pm)>,
   1.121 +L<Locale::Po4a::Guide(3pm)>,
   1.122 +L<Locale::Po4a::Halibut(3pm)>,
   1.123 +L<Locale::Po4a::Ini(3pm)>,
   1.124 +L<Locale::Po4a::KernelHelp(3pm)>,
   1.125 +L<Locale::Po4a::LaTeX(3pm)>,
   1.126 +L<Locale::Po4a::Man(3pm)>,
   1.127 +L<Locale::Po4a::Pod(3pm)>,
   1.128 +L<Locale::Po4a::Sgml(3pm)>,
   1.129 +L<Locale::Po4a::TeX(3pm)>,
   1.130 +L<Locale::Po4a::Texinfo(3pm)>,
   1.131 +L<Locale::Po4a::Text(3pm)>,
   1.132 +L<Locale::Po4a::Wml(3pm)>.
   1.133 +L<Locale::Po4a::Xhtml(3pm)>,
   1.134 +L<Locale::Po4a::Xml(3pm)>,
   1.135 +L<Locale::Po4a::Wml(3pm)>.
   1.136 +
   1.137 +=back
   1.138 +
   1.139 +=head1 AUTHORS
   1.140 +
   1.141 + Denis Barbier <barbier@linuxfr.org>
   1.142 + Martin Quinson (mquinson#debian.org)
   1.143 +
   1.144 +=head1 COPYRIGHT AND LICENSE
   1.145 +
   1.146 +Copyright 2002,2003,2004,2005 by SPI, inc.
   1.147 +
   1.148 +This program is free software; you may redistribute it and/or modify it
   1.149 +under the terms of GPL (see the COPYING file).
   1.150 +
   1.151 +=cut