Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

[RFC] Pod/ patch, for POD2::IT and other pods translations

by bepi (Deacon)
on Jul 27, 2005 at 13:03 UTC ( #478580=perlmeditation: print w/replies, xml ) Need Help??

Hi monks,

after almost two years from RFC, italian Perl users published (finally!) to CPAN a large part of translated core Perl pods (including perlfunc and perlfaq*) into the package POD2::IT where 'IT' is the language code. This has been (and currently still is) a very big work! :-)

See for more details about the project.

Once the package has been installed, the translated documentation can be accessed with:

%> perldoc POD2::IT::<podname>
However the -f and -q switches don't work no longer.

So, I made a simple patch to Pod/ 3.14 in order to allow also the syntax:

%> perldoc -L IT <podname> %> perldoc -L IT -f <function> %> perldoc -L IT -q <FAQregex>

You can apply the patch with:

%> patch -p0 `perl -MPod::Perldoc -e 'print $INC{"Pod/"}' +` < /path/to/

The patch adds the -L switch that allows to define language code for desired language translation. If POD2::<code> package doesn't exists, the effect of the switch will be ignored.

Note that the patch is for version 3.14 of Pod::Perldoc (included into Perl 5.8.7). If you have a previous Perl distro (but >= 5.8.1) and you are impatient to apply the patch, please upgrade your Pod::Perldoc module to 3.14! ;-)

Since Pod/'s search_perlfunc uses hard coded string 'Alphabetical Listing of Perl Functions' to skip introduction, in order to make it to work with other languages with the option -L, I used a simple plugin-like mechanism.

POD2::<code> language package must export search_perlfunc_re that returns a localized translation of the paragraph string above. This string will be used to skip perlfunc.pod intro. Again, if POD2::<code>->search_perlfunc_re fails (or doesn't exist), we'll come back to the default behavoiur. This mechanism allows to add additional POD2::* translations without need to patch Pod/ every time.

What do you think?


- Enrico

Replies are listed 'Best First'.
Re: [RFC] Pod/ patch, for POD2::IT and other pods translations
by Tanktalus (Canon) on Jul 27, 2005 at 15:46 UTC

    I only speak one (human) language. And I think that this, or something substantially similar, should be jumped on and accepted by p5p asap. :-) Good work!

      A better naming scheme would be nice :/

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://478580]
Approved by Mutant
Front-paged by Tanalis
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-05-26 15:00 GMT
Find Nodes?
    Voting Booth?