The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SIL::Shoe::Lang - Shoebox language file interface

SYNOPSIS

  $s = SIL::Shoe::Lang->new("filename.lng");
  $s->read;
  $s->{'srt'}{"order"}{'primary'};

DESCRIPTION

This class provides an interface to the Shoebox language file. It restructures the file for easier access and provides various support functions for sorting, etc.

In addition to those in SIL::Shoe::Control, the following methods are available:

$s->build_sorts

Builds tables to help with sort ordering, for each sort order in the language file.

$s->ducet($name)

Returns the given sort order as a set of unicode style ducet keys

$s->sort_key($name, $str)

Calculates a sort key which can be string compared for a given string and sort order name

$s->cmp($name, $level, $a, $b)

Compares the two strings according to the given sort order at the given level. Returns +1, 0, -1 accordingly as per the perl cmp operator.

@tokens = $s->tokenize($name, $level, $ignore, $str)

Returns an array of tokens that are sorting units. $ignore says whether to remove characters ignored at $level or lower from the output. For example, if 'a' were a primary character and "'" were a secondary character then

  $s->tokenize('test', 0, 0, "a'") = ("a", "'")
  $s->tokenize('test', 1, 0, "a'") = ("a'")
  $s->tokenize('test', 0, 1, "a'") = ("a")
  $s->tokenize('test', 1, 1, "a'") = ("a", "'")   # no tertiary chars to remove