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