trusty (3) Dist::Zilla::Plugin::LocaleTextDomain.3pm.gz

Provided by: libdist-zilla-localetextdomain-perl_0.87-1_all bug

Name

       Dist::Zilla::Plugin::LocaleTextDomain - Compile Local::TextDomain language files

Synopsis

       In dist.ini:

         [ShareDir]
         [LocaleTextDomain]
         textdomain = My-App
         lang_dir = po
         share_dir = share

Description

       This plugin compiles GNU gettext language files and adds them into the distribution for use by
       Locale::TextDomain. This is useful if your distribution maintains gettext language files in a directory,
       with each file named for a language. The plugin uses "msgfmt" to compile each file and then adds it to
       the distribution's share directory. You can then use the ShareDir plugin to make sure it gets installed
       in the right place.

   Installation
       Ideally, Locale::TextDomain would search for language files in the shared directory for your
       distribution, as defined by File::ShareDir. A patch <https://rt.cpan.org/Ticket/Display.html?id=79461>
       has been submitted to add this support, after which the example code from the "Synopsis" should just
       work.

       Until that time, however, Locale::TextDomain searches for files in Perl's @INC directories, in which case
       the use of the ShareDir plugin will not work. You will have to install the compiled language files into
       the lib directory in your distribution. To do so, simply set the "share_dir" attribute to "lib":

         [LocaleTextDomain]
         textdomain = My-App
         lang_dir = po
         share_dir = lib

       If your distribution uses ExtUtils::MakeMaker to do the installation, the files will now be installed in
       the proper location. If it relies on Module::Build, you will have to do a bit of additional work. First,
       subclass Module::Build by creating inc/Module/Build/MyApp.pm with this code:

         package Module::Build::MyApp;
         use parent 'Module::Build';

         sub new {
             my ( $class, %p ) = @_;
             my $self = $class->SUPER::new(%p);
             $self->add_build_element('mo');
             return $self;
         }

       Then tell Dist::Zilla to use the subclass via the "mb_class" attribute in dist.ini:

         [ModuleBuild]
         mb_class = Module::Build::MyApp

       Now the .mo files will be installed where Locale::TextDomain can find them.

   Configuration
       Configuration attributes settable in dist.ini to change the plugin behavior.

       "textdomain"

       The textdomain to use for your language files, as defined by the Locale::TextDomain documentation. This
       should be the same value declared in each use of Locale::TextDomain in your module. For example, if such
       lines look like this:

         use LocaleText::Domain qw(com.example.myApp);

       Then set it to such in your dist.ini

         [LocaleTextDomain]
         textdomain = com.example.myApp

       Defaults to the name of your distribution, which is the value that Locale::TextDomain recommends you use.

       "lang_dir"

       The directory containing your language files. Defaults to po.

       "share_dir"

       The name of the distribution directory into which compiled language files should be added. Defaults to
       "share".

       "msgfmt"

       The location of the "msgfmt" program, which is distributed with GNU gettext
       <http://www.gnu.org/software/gettext/>. Defaults to just "msgfmt", which should work if it's in your
       path.

       "language"

       A language to be compiled. May be specified more than once. If not specified, the default will be the
       list of files in "lang_dir" ending in "lange_file_suffix".

       "lang_file_suffix"

       Suffix used in the language file names. These are the files your translators maintain in your repository.
       Defaults to "po".

       "bin_file_suffix"

       Suffix to use for the compiled language file. Defaults to "mo".

Author

       David E. Wheeler <david@justatheory.com>

       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.