NAME

Zonemaster::Translator - translation support for Zonemaster

SYNOPSIS

my $trans = Zonemaster::Translator->new({ lang => 'tech' });
say $trans->to_string($entry);

ATTRIBUTES

lang

The language code for the language the translator should use. Either this or file must be provided.

file

The file from which the translation data will be loaded. If it is not provided but lang is, an attempt will be made to load a file called language_lang.json from the Zonemaster distribution directory.

data

A reference to a hash with translation data.

METHODS

to_string($entry)

Takes a Zonemaster::Logger::Entry object as its argument and returns a translated string with the timestamp, level, message and arguments in the entry.

translate_tag

Takes a Zonemaster::Logger::Entry object as its argument and returns a translation of its tag and arguments.