2 # Copyright (C) 2011 Laurentian University
3 # Author: Dan Scott <dscott@laurentian.ca>
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 # ---------------------------------------------------------------
20 use Pod::Usage qw/ pod2usage /;
27 'launchpad-base-dir=s' => \$lp_base_dir,
28 'evergreen-base-dir=s' => \$eg_base_dir,
82 multiclass_search_help.html
111 foreach my $pofile (@pofiles) {
112 foreach my $lang (keys %locs) {
113 my $src_file = File::Spec->catfile(
114 ($lp_base_dir, 'build/i18n/po', $pofile), "$lang.po"
116 my $dest_file = File::Spec->catfile(
117 ($eg_base_dir, 'build/i18n/po', $pofile), "$locs{$lang}.po"
120 # If the source file doesn't exist, move on
121 next if ! -f $src_file;
123 # Check for actual changed strings
125 my $diff = `diff -u $dest_file $src_file`;
127 # Ignore changes to the PO header
128 $diff =~ s/^\+#.*?$//ms;
129 $diff =~ s/^\+"PO-Revision-Date:.*?$//ms;
130 $diff =~ s/^\+"Report-Msgid-Bugs-To:.*?$//ms;
131 $diff =~ s/^\+"X-Launchpad-Export-Date:.*?$//ms;
132 $diff =~ s/^\+"X-Generator:.*?$//ms;
134 if ($diff =~ /^\+/sm) {
135 `cp $src_file $dest_file`;
138 # Copy brand new translations into place
139 `cp $src_file $dest_file`;
145 if (!($lp_base_dir && $eg_base_dir)) {
149 if (!-d $lp_base_dir) {
150 print STDERR "$lp_base_dir does not exist; exiting\n";
154 if (!-d $eg_base_dir) {
155 print STDERR "$eg_base_dir does not exist; exiting\n";
159 if (!-d File::Spec->catdir($lp_base_dir, '.bzr')) {
160 print STDERR "$lp_base_dir is not a bzr branch; exiting\n";
164 if (!-f File::Spec->catfile(($eg_base_dir, '.git'), 'config')) {
165 print STDERR "$eg_base_dir is not a git clone; exiting\n";
174 update_pofiles - Updates translations from Launchpad
178 B<update_pofile> B<--launchpad-base-dir>=I<translation-export-directory>
179 B<--evergreen-base-dir>=I<evergreen-git-clone-directory>
183 Assuming that you have an updated bzr checkout of the translation-export
184 to satisfy the 'launchpad-base-dir' argument, and an updated git clone
185 of Evergreen master to satisfy the 'evergreen-base-dir' argument,
186 this script attempts to copy only the new or changed translations
187 from the Launchpad directory into the Evergreen directory. It
188 converts the Launchpad I<ll> and I<ll_LL> locale names into Evergreen's
189 I<ll-LL> locale names.
191 Note that the user is still required to build, test, and check in the
192 updated translations.
198 =item * B<-l> I<translation-export-directory>, B<--launchpad-base-dir>=I<translation-export-directory>
200 Specifies the directory holding the updated bzr checkout of
201 https://code.launchpad.net/~denials/evergreen/translation-export - which
202 you can create via "bzr lp:~denials/evergreen/translation-export".
204 =item * B<-e> I<evergreen-directory>, B<--evergreen-base-dir>=I<evergreen-directory>
206 Specifies the directory holding the updated git clone of Evergreen, which you
207 can create via "git clone git://git.evergreen-ils.org/Evergreen.git".
213 Dan Scott <dscott@laurentian.ca>
215 =head1 COPYRIGHT AND LICENSE
217 Copyright 2011 by Dan Scott
219 This program is free software; you can redistribute it and/or
220 modify it under the terms of the GNU General Public License
221 as published by the Free Software Foundation; either version 2
222 of the License, or (at your option) any later version.
224 This program is distributed in the hope that it will be useful,
225 but WITHOUT ANY WARRANTY; without even the implied warranty of
226 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
227 GNU General Public License for more details.
229 You should have received a copy of the GNU General Public License
230 along with this program; if not, write to the Free Software
231 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.