3 # Copyright (C) 2010 Tamil s.a.r.l.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use lib
$FindBin::Bin
;
40 'v|verbose' => \
$verbose,
48 pod2usage
( -verbose
=> 2 );
53 usage
() if $#ARGV != 1 && $#ARGV != 0;
55 my ($cmd, $lang) = @ARGV;
57 if ( $cmd =~ /^(create|install|update|compress|uncompress)$/ ) {
58 my $installer = LangInstaller
->new( $lang, $pref, $verbose );
59 if ( $cmd ne 'create' and $lang and not grep( {$_ eq $lang} @
{ $installer->{langs
} } ) ) {
60 print "Unsupported language: $lang\n";
64 usage
() if $cmd eq 'create';
65 for my $lang ( @
{$installer->{langs
}} ) {
66 $installer->set_lang( $lang );
67 $installer->$cmd(\
@files);
71 $installer->$cmd(\
@files);
74 Koha
::Caches
->get_instance()->flush_all if $cmd ne 'update';
84 translate - Handle templates and preferences translation
88 translate create fr-FR
89 translate update fr-FR
90 translate install fr-FR
91 translate install fr-FR -f search -f memberentry
92 translate -p install fr-FR
94 translate compress [fr-FR]
95 translate uncompress [fr-FR]
99 In Koha, three categories of information are translated based on standard GNU
100 .po files: opac templates pages, intranet templates and system preferences. The
101 script is a wrapper. It allows to quickly create/update/install .po files for a
102 given language or for all available languages.
106 Use the -v or --verbose parameter to make translator more verbose.
110 =item translate create F<lang>
112 Create 3 .po files in F</misc/translator/po> subdirectory: (1) from opac pages
113 templates, (2) intranet templates, and (3) from preferences. English 'en'
114 version of templates and preferences are used as references.
118 =item F<lang>-opac-{theme}.po
120 Contains extracted text from english (en) OPAC templates found in
121 <KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory.
123 =item F<lang>-intranet.po
125 Contains extracted text from english (en) intranet templates found in
126 <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory.
128 =item F<lang>-pref.po
130 Contains extracted text from english (en) preferences. They are found in files
131 located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences
136 =item translate [-p] update F<lang>
138 Update .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, all
139 available languages are updated. With -p option, only preferences .po file is
142 =item translate [-p|-f] install F<lang>
144 Use .po files to translate the english version of templates and preferences files
145 and copy those files in the appropriate directory. Without F<lang>, all
146 available languages are installed. With -p option, only preferences .po file is
149 With -f parameter (repeatable) you can specify specific files to translate. For
150 example, -f search will translate all templates containing 'search'.
152 =item translate compress F<lang>
154 Compress .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, files
155 from all available languages are compressed.
157 =item translate uncompress F<lang>
159 Uncompress .po.gz files in F<po> directory, named F<lang>-*.po.gz. Without F<lang>,
160 files from all available languages are uncompressed.