data/TWiki/TWikiI18NExtractDotPm.txt,v
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
colas@0
     1
head	1.2;
colas@0
     2
access;
colas@0
     3
symbols;
colas@0
     4
locks; strict;
colas@0
     5
comment	@# @;
colas@0
     6
colas@0
     7
colas@0
     8
1.2
colas@0
     9
date	2007.01.16.04.12.05;	author TWikiContributor;	state Exp;
colas@0
    10
branches;
colas@0
    11
next	1.1;
colas@0
    12
colas@0
    13
1.1
colas@0
    14
date	2006.02.01.12.01.25;	author TWikiContributor;	state Exp;
colas@0
    15
branches;
colas@0
    16
next	;
colas@0
    17
colas@0
    18
colas@0
    19
desc
colas@0
    20
@new-topic
colas@0
    21
@
colas@0
    22
colas@0
    23
colas@0
    24
1.2
colas@0
    25
log
colas@0
    26
@buildrelease
colas@0
    27
@
colas@0
    28
text
colas@0
    29
@---+ Package =TWiki::I18N::Extract=
colas@0
    30
colas@0
    31
Support translatable strings extraction from TWiki topics and templates.
colas@0
    32
Depends on Locale::Maketext::Extract (part of CPAN::Locale::Maketext::Lexicon).
colas@0
    33
colas@0
    34
colas@0
    35
%TOC%
colas@0
    36
colas@0
    37
---++ ClassMethod *new* <tt>($session) -> $extract</tt>
colas@0
    38
colas@0
    39
Constructor. Creates a fresh new Extract object. A $session object, instance of
colas@0
    40
the TWiki class, is optional: if it's available, it'll be used for printing
colas@0
    41
warnings.
colas@0
    42
colas@0
    43
colas@0
    44
colas@0
    45
---++ ObjectMethod *extract* <tt>($file,$text)</tt>
colas@0
    46
colas@0
    47
Extract the strings from =$text=,m using =$file= as the name of the current
colas@0
    48
file being read (for comments in PO file, for example). Overrides the base
colas@0
    49
class method but calls it so the base behavior is preserved.
colas@0
    50
colas@0
    51
As in base class, extracted strings are just stored in the =$self='s internal
colas@0
    52
table for further use (e.g. creating/updating a PO file). Nothing is returned.
colas@0
    53
colas@0
    54
colas@0
    55
@
colas@0
    56
colas@0
    57
colas@0
    58
1.1
colas@0
    59
log
colas@0
    60
@buildrelease
colas@0
    61
@
colas@0
    62
text
colas@0
    63
@d17 1
colas@0
    64
a17 1
colas@0
    65
---++ ObjectMethod *extract* <tt>($msgid) -> $formated</tt>
colas@0
    66
d19 3
colas@0
    67
a21 4
colas@0
    68
This method overrides the one with same name in =Locale::Maketext::Extract=, as
colas@0
    69
a workaround for [[http://rt.cpan.org/Public/Bug/Display.html?id=14629][a bug]]
colas@0
    70
in the =Locale::Maketext::Lexicon= Perl package, and was not fixed up to the
colas@0
    71
0.53 release.
colas@0
    72
d23 2
colas@0
    73
a24 3
colas@0
    74
What it does is to call an alternative version of the _format function, which
colas@0
    75
avoids [[http://develop.twiki.org/~develop/cgi-bin/view/Bugs/Item1500][double-escaping]]
colas@0
    76
the extracted strings.
colas@0
    77
a25 4
colas@0
    78
This method was tested only under the circumstances of TWiki's needs, i.e.,
colas@0
    79
extracting strings from source and topics and generating a brand new POT file.
colas@0
    80
Merging with previous PO files is done with GNU gettext tools, so maybe if it's
colas@0
    81
used for merging it can 
colas@0
    82
a26 5
colas@0
    83
Once that bug is fixed, in future TWiki versions this method may be removed.
colas@0
    84
colas@0
    85
colas@0
    86
colas@0
    87
!!!extract!!!
colas@0
    88
@