1Locale::Maketext::ExtraUcste:r:PCloungtirni:b:uTtTe2dL(o3Pc)earlle:D:oMcaukmeetnetxatt:i:oEnxtract::Plugin::TT2(3)
2
3
4

NAME

6       Locale::Maketext::Extract::Plugin::TT2 - Template Toolkit format parser
7

SYNOPSIS

9           $plugin = Locale::Maketext::Extract::Plugin::TT2->new(
10               $lexicon            # A Locale::Maketext::Extract object
11               @file_types         # Optionally specify a list of recognised file types
12           )
13
14           $plugin->extract($filename,$filecontents);
15

DESCRIPTION

17       Extracts strings to localise from Template Toolkit templates.
18

SHORT PLUGIN NAME

20           tt2
21

VALID FORMATS

23       Valid formats are:
24
25       [% |l(args) %]string[% END %]
26       [% 'string' | l(args) %]
27       [% l('string',args) %]
28
29       l and loc are interchangeable.
30
31       | and FILTER are interchangeable.
32

KNOWN FILE TYPES

34       .tt
35       .tt2
36       .html
37       .tt.*
38       .tt2.*
39

REQUIRES

41       Template
42

NOTES

44       ·   BEWARE Using the "loc" form can give false positives if you use the
45           Perl parser plugin on TT files.  If you want to use the "loc" form,
46           then you should specify the file types that you want to the Perl
47           plugin to parse, or enable the default file types, eg:
48
49              xgetext.pl -P perl ....        # default file types
50              xgettext.pl -P perl=pl,pm  ... # specified file types
51
52       ·   The string-to-be-localised must be a string, not a variable. We try
53           not to extract calls to your localise function which contain
54           variables eg:
55
56               l('string',arg)  # extracted
57               l(var,arg)       # not extracted
58
59           This doesn't work for block filters, so don't do that. Eg:
60
61               [%  FILTER l %]
62                  string [% var %]      # BAD!
63               [% END %]
64
65       ·   Getting the right line number is difficult in TT. Often it'll be a
66           range of lines, or it may be thrown out by the use of PRE_CHOMP or
67           POST_CHOMP.  It will always be within a few lines of the correct
68           location.
69
70       ·   If you have PRE/POST_CHOMP enabled by default in your templates,
71           then you should extract the strings using the same values.  In
72           order to set them, you can use the following wrapper script:
73
74              #!/usr/bin/perl
75
76              use Locale::Maketext::Extract::Run qw(xgettext);
77              use Locale::Maketext::Extract::Plugin::TT2();
78
79              %Locale::Maketext::Extract::Plugin::TT2::PARSER_OPTIONS = (
80                   PRE_CHOMP  => 1, # or 2
81                   POST_CHOMP => 1, # or 2
82
83                   # Also START/END_TAG, ANYCASE, INTERPOLATE, V1DOLLAR, EVAL_PERL
84              );
85
86              xgettext(@ARGV);
87

ACKNOWLEDGEMENTS

89       Thanks to Andy Wardley for writing the Template::Directive subclass
90       which made this possible.
91

SEE ALSO

93       xgettext.pl
94           for extracting translatable strings from common template systems
95           and perl source files.
96
97       Locale::Maketext::Lexicon
98       Locale::Maketext::Extract::Plugin::Base
99       Locale::Maketext::Extract::Plugin::FormFu
100       Locale::Maketext::Extract::Plugin::Perl
101       Locale::Maketext::Extract::Plugin::YAML
102       Locale::Maketext::Extract::Plugin::Mason
103       Locale::Maketext::Extract::Plugin::TextTemplate
104       Locale::Maketext::Extract::Plugin::Generic
105       Template::Toolkit
106

AUTHORS

108       Clinton Gormley <clint@traveljury.com>
109
110       Andy Wardley http://wardley.org
111
113       Copyright 2002-2008 by Audrey Tang <cpan@audreyt.org>.
114
115       This software is released under the MIT license cited below.
116
117   The "MIT" License
118       Permission is hereby granted, free of charge, to any person obtaining a
119       copy of this software and associated documentation files (the
120       "Software"), to deal in the Software without restriction, including
121       without limitation the rights to use, copy, modify, merge, publish,
122       distribute, sublicense, and/or sell copies of the Software, and to
123       permit persons to whom the Software is furnished to do so, subject to
124       the following conditions:
125
126       The above copyright notice and this permission notice shall be included
127       in all copies or substantial portions of the Software.
128
129       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
130       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
131       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
132       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
133       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
134       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
135       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136
137
138
139perl v5.12.2                      2010L-o0c8a-l1e0::Maketext::Extract::Plugin::TT2(3)
Impressum