.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Dist::Zilla::Plugin::LocaleTextDomain 3pm" .TH Dist::Zilla::Plugin::LocaleTextDomain 3pm "2018-07-08" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "Name" .IX Header "Name" Dist::Zilla::Plugin::LocaleTextDomain \- Compile Local::TextDomain language files .SH "Synopsis" .IX Header "Synopsis" In \fIdist.ini\fR: .PP .Vb 5 \& [ShareDir] \& [LocaleTextDomain] \& textdomain = My\-App \& lang_dir = po \& share_dir = share .Ve .SH "Description" .IX Header "Description" This plugin compiles \s-1GNU\s0 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 \f(CW\*(C`msgfmt\*(C'\fR to compile each file and then adds it to the distribution's \fIshare\fR directory. You can then use the ShareDir plugin to make sure it gets installed in the right place. .SS "Installation" .IX Subsection "Installation" By default, Locale::TextDomain searches for language files in the shared directory for your distribution, as defined by File::ShareDir. Prior to v1.21, however, this was not the case. Instead, it searched for files in Perl's \f(CW@INC\fR directories. If you're stuck with one of these older versions of Locale::TextDomain, you'll have to install the compiled language files into the \fIlib\fR directory in your distribution. To do so, simply set the \&\f(CW\*(C`share_dir\*(C'\fR attribute to \*(L"lib\*(R": .PP .Vb 4 \& [LocaleTextDomain] \& textdomain = My\-App \& lang_dir = po \& share_dir = lib .Ve .PP 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 \fIinc/Module/Build/MyApp.pm\fR with this code: .PP .Vb 2 \& package Module::Build::MyApp; \& use parent \*(AqModule::Build\*(Aq; \& \& sub new { \& my ( $class, %p ) = @_; \& my $self = $class\->SUPER::new(%p); \& $self\->add_build_element(\*(Aqmo\*(Aq); \& return $self; \& } .Ve .PP Then tell Dist::Zilla to use the subclass via the \f(CW\*(C`mb_class\*(C'\fR attribute in \&\fIdist.ini\fR: .PP .Vb 2 \& [ModuleBuild] \& mb_class = Module::Build::MyApp .Ve .PP Now the \fI.mo\fR files will be installed where Locale::TextDomain can find them. .SS "Configuration" .IX Subsection "Configuration" Configuration attributes settable in \fIdist.ini\fR to change the plugin behavior. .PP \fI\f(CI\*(C`textdomain\*(C'\fI\fR .IX Subsection "textdomain" .PP 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: .PP .Vb 1 \& use LocaleText::Domain qw(com.example.myApp); .Ve .PP Then set it to such in your \fIdist.ini\fR .PP .Vb 2 \& [LocaleTextDomain] \& textdomain = com.example.myApp .Ve .PP Defaults to the name of your distribution, which is the value that Locale::TextDomain recommends you use. .PP \fI\f(CI\*(C`lang_dir\*(C'\fI\fR .IX Subsection "lang_dir" .PP The directory containing your language files. Defaults to \fIpo\fR. .PP \fI\f(CI\*(C`share_dir\*(C'\fI\fR .IX Subsection "share_dir" .PP The name of the distribution directory into which compiled language files should be added. Defaults to \f(CW\*(C`share\*(C'\fR. .PP \fI\f(CI\*(C`msgfmt\*(C'\fI\fR .IX Subsection "msgfmt" .PP The location of the \f(CW\*(C`msgfmt\*(C'\fR program, which is distributed with \s-1GNU\s0 gettext . Defaults to just \f(CW\*(C`msgfmt\*(C'\fR, which should work if it's in your path. .PP \fI\f(CI\*(C`language\*(C'\fI\fR .IX Subsection "language" .PP A language to be compiled. May be specified more than once. If not specified, the default will be the list of files in \f(CW\*(C`lang_dir\*(C'\fR ending in \&\f(CW\*(C`lange_file_suffix\*(C'\fR. .PP \fI\f(CI\*(C`lang_file_suffix\*(C'\fI\fR .IX Subsection "lang_file_suffix" .PP Suffix used in the language file names. These are the files your translators maintain in your repository. Defaults to \f(CW\*(C`po\*(C'\fR. .PP \fI\f(CI\*(C`bin_file_suffix\*(C'\fI\fR .IX Subsection "bin_file_suffix" .PP Suffix to use for the compiled language file. Defaults to \f(CW\*(C`mo\*(C'\fR. .PP \fI\f(CI\*(C`finder\*(C'\fI\fR .IX Subsection "finder" .PP File finders to use to look for files to search for strings to extract. May be specified more than once. If not specified, the default will be \&\f(CW\*(C`:InstallModules\*(C'\fR and \f(CW\*(C`:ExecFiles\*(C'\fR; that is, files below \fIlib/\fR and executable files marked by e.g. the \f(CW\*(C`ExecDir\*(C'\fR plugin. You can also combine default finders with custom ones based on a \&\f(CW\*(C`FileFinder\*(C'\fR plugin. For example: .PP .Vb 2 \& [FileFinder::ByName / MyFiles] \& file = *.pl \& \& [LocaleTextDomain] \& finder = MyFiles \& finder = :ShareFiles .Ve .PP This configuration will extract strings from files that match \f(CW\*(C`*.pl\*(C'\fR and all files in a share directory. .PP \fI\f(CI\*(C`xgettext_args\*(C'\fI\fR .IX Subsection "xgettext_args" .PP Extra arguments to be passed to the extractor program. This is an advanced feature that exists for cases where special customization is needed, such as when different keywords are used to mark strings. .PP \fI\f(CI\*(C`override_args\*(C'\fI\fR .IX Subsection "override_args" .PP By default, arguments are passed to the extractor that set the language to \&\*(L"perl\*(R" as well as set keywords that tell xgettext how strings are marked (which includes the keywords specified by Locale::TextDomain). If for some reason you don't want that (presumably because you're going to use the \&\f(CW\*(C`xgettext_args\*(C'\fR attribute to configure your own language and keywords), then you can set this attribute to true. .PP \fI\f(CI\*(C`join_existing\*(C'\fI\fR .IX Subsection "join_existing" .PP If you have strings in files other than Perl files, you can cause the extractor to be invoked multiple times against different sets of files with different arguments. The strings from all of these other file sets will be joined into your \f(CW\*(C`po\*(C'\fR files. .PP For example, imagine you have a \s-1GTK+\s0 app. You have strings in your Perl modules, as usual, but perhaps you also have strings in your Glade files that you want to be translatable. You could write something like this into your \&\fIdist.ini\fR: .PP .Vb 2 \& [FileFinder::ByName / GladeFiles] \& file = *.ui \& \& [LocaleTextDomain] \& join_existing = \-\-language=glade %{GladeFiles}f .Ve .PP The value of the \f(CW\*(C`join_existing\*(C'\fR attribute is the argument list that will be passed to an additional invocation of xgettext. The \f(CW\*(C`%{GladeFiles}f\*(C'\fR syntax allows you to use a finder to search for files to be passed to the extractor, but you could also \*(L"hard code\*(R" one or more files as well. .PP This attribute is repeatable. If your project also had a JavaScript file with strings, you could just add another line to your \f(CW\*(C`LocaleTextDomain\*(C'\fR section: .PP .Vb 1 \& join_existing = \-L javascript share/media/app.js .Ve .SH "Author" .IX Header "Author" David E. Wheeler .SH "Contributor" .IX Header "Contributor" Charles McGarvey .SH "Copyright and License" .IX Header "Copyright and License" This software is copyright (c) 2012\-2017 by David E. Wheeler. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.