METHODS

Constructors

$class->new( DIRECTORY, OPTIONS )

Create an index for a certain directory. If the directory does not exist, then the object will still be created.

Accessors

$obj->directory

Returns the directory name.

$obj->addFile( BASENAME, [ABSOLUTE] )

Add a certain file to the index. This method returns the ABSOLUTE path to that file, which must be used to access it. When not explicitly specified, the ABSOLUTE path will be calculated.

$obj->find( TEXTDOMAIN, LOCALE )

Lookup the best translation table, according to the rules described in chapter DETAILS, below.

Returned is a filename, or undef if nothing is defined for the LOCALE (there is no default on this level).

$obj->index

For internal use only. Force the creation of the index (if not already done). Returns a hash with key-value pairs, where the key is the lower-cased version of the filename, and the value the case-sensitive version of the filename.

$obj->list( DOMAIN, [EXTENSION] )

Returned is a list of filenames which is used to update the list of MSGIDs when source files have changed. All translation files which belong to a certain DOMAIN are listed.

The EXTENSION filter can be used to reduce the filenames further, for instance to select only po or only mo files, and ignore readme's. Use an string, without dot and interpreted case-insensitive, or a regular expresion.

» Example:
  my @l = $index->list('my-domain');
  my @l = $index->list('my-domain', 'po');
  my @l = $index->list('my-domain', qr/^readme/i);