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,
72 multiclass_search_help.html
92 foreach my $pofile (@pofiles) {
93 foreach my $lang (keys %locs) {
94 my $src_file = File::Spec->catfile(
95 ($lp_base_dir, 'build/i18n/po', $pofile), "$lang.po"
97 my $dest_file = File::Spec->catfile(
98 ($eg_base_dir, 'build/i18n/po', $pofile), "$locs{$lang}.po"
101 # If the source file doesn't exist, move on
102 next if ! -f $src_file;
104 # Check for actual changed strings
106 my $diff = `diff -u $dest_file $src_file`;
108 # Ignore changes to the PO header
109 $diff =~ s/^\+#.*?$//ms;
110 $diff =~ s/^\+"PO-Revision-Date:.*?$//ms;
111 $diff =~ s/^\+"Report-Msgid-Bugs-To:.*?$//ms;
112 $diff =~ s/^\+"X-Launchpad-Export-Date:.*?$//ms;
113 $diff =~ s/^\+"X-Generator:.*?$//ms;
115 if ($diff =~ /^\+/sm) {
116 `cp $src_file $dest_file`;
119 # Copy brand new translations into place
120 `cp $src_file $dest_file`;
126 if (!($lp_base_dir && $eg_base_dir)) {
130 if (!-d $lp_base_dir) {
131 print STDERR "$lp_base_dir does not exist; exiting\n";
135 if (!-d $eg_base_dir) {
136 print STDERR "$eg_base_dir does not exist; exiting\n";
140 if (!-d File::Spec->catdir($lp_base_dir, '.bzr')) {
141 print STDERR "$lp_base_dir is not a bzr branch; exiting\n";
145 if (!-f File::Spec->catfile(($eg_base_dir, '.git'), 'config')) {
146 print STDERR "$eg_base_dir is not a git clone; exiting\n";
155 update_pofiles - Updates translations from Launchpad
159 B<update_pofile> B<--launchpad-base-dir>=I<translation-export-directory>
160 B<--evergreen-base-dir>=I<evergreen-git-clone-directory>
164 Assuming that you have an updated bzr checkout of
165 satisfy the 'launchpad-base-dir' argument, and an updated git clone
166 of Evergreen master to satisfy the 'evergreen-base-dir' argument,
167 this script attempts to copy only the new or changed translations
168 from the Launchpad directory into the Evergreen directory. It
169 converts the Launchpad I<ll> and I<ll_LL> locale names into Evergreen's
170 I<ll-LL> locale names.
172 Note that the user is still required to build, test, and check in the
173 updated translations.
179 =item * B<-l> I<translation-export-directory>, B<--launchpad-base-dir>=I<translation-export-directory>
181 Specifies the directory holding the updated bzr checkout of
182 https://code.launchpad.net/~denials/evergreen/translation-export
184 =item * B<-e> I<evergreen-directory>, B<--evergreen-base-dir>=I<evergreen-directory>
186 Specifies the directory holding the updated git clone of Evergreen.
192 Dan Scott <dscott@laurentian.ca>
194 =head1 COPYRIGHT AND LICENSE
196 Copyright 2011 by Dan Scott
198 This program is free software; you can redistribute it and/or
199 modify it under the terms of the GNU General Public License
200 as published by the Free Software Foundation; either version 2
201 of the License, or (at your option) any later version.
203 This program is distributed in the hope that it will be useful,
204 but WITHOUT ANY WARRANTY; without even the implied warranty of
205 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
206 GNU General Public License for more details.
208 You should have received a copy of the GNU General Public License
209 along with this program; if not, write to the Free Software
210 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.