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 under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 'v|verbose' => \$verbose,
41 pod2usage( -verbose => 2 );
46 usage() if $#ARGV != 1 && $#ARGV != 0;
48 my ($cmd, $lang) = @ARGV;
50 if ( $cmd =~ /create|install|update/ ) {
51 my $installer = LangInstaller->new( $lang, $pref, $verbose );
52 if ( $cmd !~ /create/ && $lang && not $lang ~~ $installer->{langs} ) {
53 print "Unsupported language: $lang\n";
57 usage() if $cmd eq 'create';
58 for my $lang ( @{$installer->{langs}} ) {
59 $installer->set_lang( $lang );
75 translate - Handle templates and preferences translation
79 translate create fr-FR
80 translate update fr-FR
81 translate install fr-FR
82 translate -p install fr-FR
87 In Koha, three categories of information are translated based on standard GNU
88 .po files: opac templates pages, intranet templates and system preferences. The
89 script is a wrapper. It allows to quickly create/update/install .po files for a
90 given language or for all available languages.
94 Use the -v or --verbose parameter to make translator more verbose.
98 =item translate create F<lang>
100 Create 3 .po files in F</misc/translator/po> subdirectory: (1) from opac pages
101 templates, (2) intranet templates, and (3) from preferences. English 'en'
102 version of templates and preferences are used as references.
106 =item F<lang>-opac.po
108 Contains extracted text from english (en) OPAC templates found in
109 <KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory.
111 =item F<lang>-intranet.po
113 Contains extracted text from english (en) intranet templates found in
114 <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory.
116 =item F<lang>-pref.po
118 Contains extracted text from english (en) preferences. They are found in files
119 located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences
124 =item translate [-p] update F<lang>
126 Update .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, all
127 available languages are updated. With -p option, only preferences .po file is
130 =item translate [-p] install F<lang>
132 Use .po files to translate the english version of templates and preferences files
133 and copy those files in the appropriate directory. Without F<lang>, all
134 available languages are installed. With -p option, only preferences .po file is