|P is for Practical|
[RFC] Pod/Perldoc.pm patch, for POD2::IT and other pods translationsby bepi (Deacon)
|on Jul 27, 2005 at 13:03 UTC||Need Help??|
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 http://pod2it.sf.net for more details about the project.
Once the package has been installed, the translated documentation can be accessed with:
However the -f and -q switches don't work no longer.
So, I made a simple patch to Pod/Perldoc.pm 3.14 in order to allow also the syntax:
You can apply the patch with:
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/Perldoc.pm'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/Perldoc.pm every time.
What do you think?