{
    "mode": "perldoc",
    "parameter": "Locale::Maketext::Extract::Plugin::TT2",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3ATT2/json",
    "generated": "2026-10-04T16:53:44Z",
    "synopsis": "$plugin = Locale::Maketext::Extract::Plugin::TT2->new(\n$lexicon            # A Locale::Maketext::Extract object\n@filetypes         # Optionally specify a list of recognised file types\n)\n$plugin->extract($filename,$filecontents);",
    "sections": {
        "NAME": {
            "content": "Locale::Maketext::Extract::Plugin::TT2 - Template Toolkit format parser\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 1.00\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "$plugin = Locale::Maketext::Extract::Plugin::TT2->new(\n$lexicon            # A Locale::Maketext::Extract object\n@filetypes         # Optionally specify a list of recognised file types\n)\n\n$plugin->extract($filename,$filecontents);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Extracts strings to localise from Template Toolkit templates.\n",
            "subsections": []
        },
        "SHORT PLUGIN NAME": {
            "content": "tt2\n",
            "subsections": []
        },
        "VALID FORMATS": {
            "content": "Valid formats are:\n\n[% |l(args) %]string[% END %]\n[% 'string' | l(args) %]\n[% l('string',args) %]\n[% c.l('string') %]\nAlso all the above combinations with \"c.\" prepended should work correctly. This is the\ndefault syntax when using TT templates with Mojolicious.\n\nl and loc are interchangeable.\n\n| and FILTER are interchangeable.\n",
            "subsections": []
        },
        "KNOWN FILE TYPES": {
            "content": ".tt\n.tt2\n.html\n.tt.*\n.tt2.*\n",
            "subsections": []
        },
        "REQUIRES": {
            "content": "Template\n",
            "subsections": []
        },
        "NOTES": {
            "content": "*   BEWARE Using the \"loc\" form can give false positives if you use the Perl parser plugin on TT\nfiles. If you want to use the \"loc\" form, then you should specify the file types that you\nwant to the Perl plugin to parse, or enable the default file types, eg:\n\nxgetext.pl -P perl ....        # default file types\nxgettext.pl -P perl=pl,pm  ... # specified file types\n\n*   The string-to-be-localised must be a string, not a variable. We try not to extract calls to\nyour localise function which contain variables eg:\n\nl('string',arg)  # extracted\nl(var,arg)       # not extracted\n\nThis doesn't work for block filters, so don't do that. Eg:\n\n[%  FILTER l %]\nstring [% var %]      # BAD!\n[% END %]\n\n*   Getting the right line number is difficult in TT. Often it'll be a range of lines, or it may\nbe thrown out by the use of PRECHOMP or POSTCHOMP. It will always be within a few lines of\nthe correct location.\n\n*   If you have PRE/POSTCHOMP enabled by default in your templates, then you should extract the\nstrings using the same values. In order to set them, you can use the following wrapper\nscript:\n\n#!/usr/bin/perl\n\nuse Locale::Maketext::Extract::Run qw(xgettext);\nuse Locale::Maketext::Extract::Plugin::TT2();\n\n%Locale::Maketext::Extract::Plugin::TT2::PARSEROPTIONS = (\nPRECHOMP  => 1, # or 2\nPOSTCHOMP => 1, # or 2\n\n# Also START/ENDTAG, ANYCASE, INTERPOLATE, V1DOLLAR, EVALPERL\n);\n\nxgettext(@ARGV);\n",
            "subsections": []
        },
        "ACKNOWLEDGEMENTS": {
            "content": "Thanks to Andy Wardley for writing the Template::Directive subclass which made this possible.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "xgettext.pl\nfor extracting translatable strings from common template systems and perl source files.\n\nLocale::Maketext::Lexicon\nLocale::Maketext::Extract::Plugin::Base\nLocale::Maketext::Extract::Plugin::FormFu\nLocale::Maketext::Extract::Plugin::Perl\nLocale::Maketext::Extract::Plugin::YAML\nLocale::Maketext::Extract::Plugin::Mason\nLocale::Maketext::Extract::Plugin::TextTemplate\nLocale::Maketext::Extract::Plugin::Generic\nTemplate::Toolkit\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   Clinton Gormley <drtech@cpan.org>\n\n*   Audrey Tang <cpan@audreyt.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2002-2013 by Audrey Tang <cpan@audreyt.org>.\n\nThis software is released under the MIT license cited below.\n\nThe \"MIT\" License\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software\nand associated documentation files (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or\nsubstantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING\nBUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is Copyright (c) 2014 by Audrey Tang.\n\nThis is free software, licensed under:\n\nThe MIT (X11) License\n",
            "subsections": []
        }
    },
    "summary": "Locale::Maketext::Extract::Plugin::TT2 - Template Toolkit format parser",
    "flags": [],
    "examples": [],
    "see_also": []
}