source: osm/applications/editors/josm/plugins/photoadjust/importpo.pl@ 30130

Last change on this file since 30130 was 30130, checked in by holgermappt, 12 years ago

Initial checkin of JOSM PhotoAdjust plugin.

  • Property svn:executable set to *
File size: 1002 bytes
Line 
1#! /usr/bin/perl -w
2###
3### importpo.pl - Import the translation from the tarball downloaded
4### from Launchpad.
5
6use strict;
7use File::Copy;
8use Cwd;
9use File::Spec::Functions;
10
11### Name of the tarball downloaded from Launchpad.
12my $tarball = "launchpad-export.tar.gz";
13### Temporary directory.
14my $workdir = "importpo";
15### Remove the temp. directory after the work is done (0/1)?
16my $rmworkdir = 1;
17### Destination directory relative to directory where this script was
18### started in.
19my $podir = "po";
20
21die "Tarball $tarball not found.\n" if (! -r $tarball);
22if (! -d $workdir) {
23 mkdir $workdir or die "Failed to create directory $workdir: $!";
24}
25copy($tarball, $workdir);
26my $startdir = getcwd();
27chdir $workdir;
28system "tar -xf $tarball";
29foreach my $lpponame (split("\n", `find po -name "*.po"`)) {
30 if ($lpponame =~ /([a-zA-Z_]+\.po)/) {
31 my $poname = $1;
32 copy($lpponame, catfile($startdir, $podir, $poname));
33 }
34}
35
36if ($rmworkdir) {
37 chdir $startdir;
38 system "rm -rf $workdir";
39}
Note: See TracBrowser for help on using the repository browser.