SYNOPSIS

  use Template;
  use Template::Multilingual::Parser;

  my $parser = Template::Multilingual::Parser->new();
  my $template = Template->new(PARSER => $parser);
  $template->process('example.ttml', { language => 'en'});

NAME

Template::Multilingual::Parser - Multilingual template parser

DESCRIPTION

A subclass of Template::Parser that parses multilingual text sections. This module is used internally by Template::Multilingual.

METHODS

new(\%params)

The new() constructor creates and returns a reference to a new parser object. A reference to a hash may be supplied as a parameter to provide configuration values.

Configuration values are all valid Template::Parser superclass options, and one specific to this class:

LANGUAGE_VAR

The LANGUAGE_VAR option can be used to set the name of the template variable which contains the current language. Defaults to language.

my $parser = Template::Multilingual::Parser->new({
   LANGUAGE_VAR => 'global.language',
});

parse($text)

The parse() method parses multilingual sections from the input text and translates them to Template Toolkit directives. The result is then passed to the Template::Parser superclass.