Dist::Zilla::Plugin::PotFile(3) Something finds or creates a gettext language translation template file


  with 'Dist::Zilla::Role::PotFile';
  # ...
  sub execute {
      my $self = shift;
      my $pot_file = $self->pot_file(%params);


This role provides a utility method for finding or creating a GNU gettext <http://www.gnu.org/software/gettext/>-style language translation template.

Instance Methods



Finds or creates a temporary GNU gettext <http://www.gnu.org/software/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:

A path to an existing translation template file. If this file does not exist, an exception will be thrown.
Path to the "xgettext" application. Defaults to just "xgettext" ("xgettext.exe" on Windows), which should work if it's in your path.
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.
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.


David E. Wheeler <[email protected]>

Copyright and License

This software is copyright (c) 2012-2013 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.