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 http://pod2it.sf.net 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/Perldoc.pm 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/Perldoc.pm"}' +` < /path/to/Perldoc.pm-3.14-patch

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?

Regards

- Enrico


In reply to [RFC] Pod/Perldoc.pm patch, for POD2::IT and other pods translations by bepi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.