Name

Dist::Zilla::Plugin::PotFile - Something finds or creates a gettext language translation template file

Synopsis

with 'Dist::Zilla::Role::PotFile';

# ...

sub execute {
    my $self = shift;
    my $pot_file = $self->pot_file(%params);
}

Description

This role provides a utility method for finding or creating a GNU gettext-style language translation template.

Instance Methods

pot_file

$self->pot_file(%params);

Finds or creates a temporary GNU gettext-style language translation file. It works in this order:

  • If the pot_file parameter is passed a value and the named file exists, it will be returned.

  • If the file stored in the language directory, as specified for the LocaleTextDomain plugin, with the name of the distribution and ending in .pot, it will be returned. This is the default location for a template file created by the msg-scan command.

  • The sources will be scanned for localizable strings and a temporary template file created. This file will automatically be deleted at program exit.

The supported parameters are:

pot_file

A path to an existing translation template file. If this file does not exist, an exception will be thrown.

xgettext

Path to the xgettext application. Defaults to just xgettext (xgettext.exe on Windows), which should work if it's in your path.

encoding

Encoding to assume when scanning for localizable strings. Defaults to UTF-8.

The name of the translation copyright holder. Defaults to the copyright holder configured for Dist::Zilla.

bugs_email

Email address for reporting translation bugs. Defaults to the email address of the first author known to Dist::Zilla, if available and parseable by Email::Address.

Author

David E. Wheeler <david@justatheory.com>

Contributor

Charles McGarvey <ccm@cpan.org>

Copyright and License

This software is copyright (c) 2012-2017 by David E. Wheeler.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.