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>.
35 'v|verbose' => \
$verbose,
43 pod2usage
( -verbose
=> 2 );
48 usage
() if $#ARGV != 1 && $#ARGV != 0;
50 my ($cmd, $lang) = @ARGV;
52 if ( $cmd =~ /create|install|update/ ) {
53 my $installer = LangInstaller
->new( $lang, $pref, $verbose );
54 if ( $cmd ne 'create' and $lang and not grep( /^$lang$/, @
{ $installer->{langs
} } ) ) {
55 print "Unsupported language: $lang\n";
59 usage
() if $cmd eq 'create';
60 for my $lang ( @
{$installer->{langs
}} ) {
61 $installer->set_lang( $lang );
62 $installer->$cmd(\
@files);
66 $installer->$cmd(\
@files);
77 translate - Handle templates and preferences translation
81 translate create fr-FR
82 translate update fr-FR
83 translate install fr-FR
84 translate install fr-FR -f search -f memberentry
85 translate -p install fr-FR
90 In Koha, three categories of information are translated based on standard GNU
91 .po files: opac templates pages, intranet templates and system preferences. The
92 script is a wrapper. It allows to quickly create/update/install .po files for a
93 given language or for all available languages.
97 Use the -v or --verbose parameter to make translator more verbose.
101 =item translate create F<lang>
103 Create 3 .po files in F</misc/translator/po> subdirectory: (1) from opac pages
104 templates, (2) intranet templates, and (3) from preferences. English 'en'
105 version of templates and preferences are used as references.
109 =item F<lang>-opac-{theme}.po
111 Contains extracted text from english (en) OPAC templates found in
112 <KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory.
114 =item F<lang>-intranet.po
116 Contains extracted text from english (en) intranet templates found in
117 <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory.
119 =item F<lang>-pref.po
121 Contains extracted text from english (en) preferences. They are found in files
122 located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences
127 =item translate [-p] update F<lang>
129 Update .po files in F<po> directory, named F<lang>-*.po. Without F<lang>, all
130 available languages are updated. With -p option, only preferences .po file is
133 =item translate [-p|-f] install F<lang>
135 Use .po files to translate the english version of templates and preferences files
136 and copy those files in the appropriate directory. Without F<lang>, all
137 available languages are installed. With -p option, only preferences .po file is
140 With -f parameter (repeatable) you can specify specific files to translate. For
141 example, -f search will translate all templates containing 'search'.