Martin Hosken > SIL-Shoe-1.37 > SIL::Shoe::Lang



Annotate this POD


New  2
Open  0
View/Report Bugs


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


  $s = SIL::Shoe::Lang->new("filename.lng");


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:


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


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
syntax highlighting: