Hi all,

after almost two years from RFC, italian Perl users (finally!) published 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 impressive work! :-)

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

        %> perldoc POD2::IT::<podname>

However the -f and -q swithces don't work no longer.

So, I've attached the patch to Pod/Perldoc.pm in order to allow also the
syntax:

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

I added a -L switch that allow to define language code for desired language
translation. If POD2::<code> package doesn't exists, the effect of the switch
will be ignored.

Since 'search_perlfunc' uses hard coded string 'Alphabetical Listing of Perl
Functions' to skip introduction, in order to make to work it 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. This string will be used to skip
perlfunc intro.
Again, if POD2::<code>->search_perlfunc_re fails (or doesn't exist), we'll come
back to the default behavoiur.
This plugin-like mechanism allows to add additional POD2::* translations without
need to patch Perldoc.pm every time.

What do you think?

Regards

        - Enrico

Attachment: Perldoc.pm-3.14-patch
Description: Binary data

Reply via email to