METHODS

Constructors

$class->new( $directory, %options )

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

All files the $directory tree which are recognized as an translation table format which is understood will be listed. Momentarily, those are:

=over

  • . files with extension "po", see Log::Report::Lexicon::POTcompact

  • . [0.993] files with extension "mo", see Log::Report::Lexicon::MOTcompact

    [0.99] Files which are in directories which start with a dot (hidden directories) and files which start with a dot (hidden files) are skipped.

  • 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, mo or gmo files, and ignore readme's. Use an string, without dot and interpreted case-insensitive, or a regular expression.

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