NAME

oEdtk::Dict - INI-backed translation dictionary

SYNOPSIS

use oEdtk::Dict;

my $dict  = oEdtk::Dict->new('countries.ini', { section => 'COUNTRIES' });
my $label = $dict->translate('FR');
my $text  = $dict->substitue('Payable a FR');

DESCRIPTION

Loads a dictionary from one section of an INI file and offers word lookup and global substitution. It backs the corporate-entity, character translation and country dictionaries used across the toolkit.

METHODS

new

my $dict = oEdtk::Dict->new($path, $options);

Read the $path INI file and build the dictionary. $options accepts: invert (swap keys and values, default off), section (INI section to read, default DEFAULT) and ignore_case (fold keys to lowercase, default on).

translate

my $value = $dict->translate($word, $check);

Look up $word and return its translation. When $check is true an unknown word yields undef; otherwise the word is returned unchanged.

substitue

my $text = $dict->substitue($var);

Case-insensitively replace every dictionary entry found in $var and return the result. (The name keeps the historical spelling.)

AUTHOR

The oEdtk team.