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.
96 =item translate create F<lang>
98 Create 3 .po files in F</misc/translator/po> subdirectory: (1) from opac pages
99 templates, (2) intranet templates, and (3) from preferences. English 'en'
100 version of templates and preferences are used as references.
104 =item F<lang>-opac.po
106 Contains extracted text from english (en) OPAC templates found in
107 <KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory.
109 =item F<lang>-intranet.po
111 Contains extracted text from english (en) intranet templates found in
112 <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory.
114 =item F<lang>-pref.po
116 Contains extracted text from english (en) preferences. They are found in files
117 located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences
122 =item translate [-p] update F<lang>
124 Update .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, all
125 available languages are updated. With -p option, only preferences .po file is
128 =item translate [-p] install F<lang>
130 Use .po files to translate the english version of templayes and preferences files
131 and copy those files in the appropriate directory. Without F<lang>, all
132 available languages are installed. With -p option, only preferences .po file is