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 =~ /^(install|compress|uncompress)$/ ) {
58 my $installer = LangInstaller->new( $lang, $pref, $verbose );
59 if ( $lang and not grep( {$_ eq $lang} @{ $installer->{langs} } ) ) {
60 print "Unsupported language: $lang\n";
64 for my $lang ( @{$installer->{langs}} ) {
65 $installer->set_lang( $lang );
66 $installer->$cmd(\@files);
70 $installer->$cmd(\@files);
73 Koha::Caches->get_instance()->flush_all;
74 } elsif ($cmd eq 'create' or $cmd eq 'update') {
75 my $command = "gulp po:$cmd";
76 $command .= " --silent" if (!$verbose);
77 $command .= " --lang $lang" if ($lang);
80 print STDERR "Deprecation notice: PO creation and update are now gulp tasks. See docs/development/internationalization.md\n";
81 print STDERR "Running `$command`\n";
93 translate - Handle templates and preferences translation
97 translate install fr-FR
98 translate install fr-FR -f search -f memberentry
99 translate -p install fr-FR
100 translate compress [fr-FR]
101 translate uncompress [fr-FR]
105 In Koha, three categories of information are translated based on standard GNU
106 .po files: opac templates pages, intranet templates and system preferences. The
107 script is a wrapper. It allows to quickly install .po files for a
108 given language or for all available languages.
112 Use the -v or --verbose parameter to make translator more verbose.
116 =item translate [-p|-f] install F<lang>
118 Use .po files to translate the english version of templates and preferences files
119 and copy those files in the appropriate directory. Without F<lang>, all
120 available languages are installed. With -p option, only preferences .po file is
123 With -f parameter (repeatable) you can specify specific files to translate. For
124 example, -f search will translate all templates containing 'search'.
126 =item translate compress F<lang>
128 Compress .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, files
129 from all available languages are compressed.
131 =item translate uncompress F<lang>
133 Uncompress .po.gz files in F<po> directory, named F<lang>-*.po.gz. Without F<lang>,
134 files from all available languages are uncompressed.