Ignore:
Timestamp:
2013-12-19T17:04:32+01:00 (13 years ago)
Author:
holgermappt
Message:

Update of translation chain. Added translated languages.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photoadjust/poimport.pl

    r30130 r30137  
    11#! /usr/bin/perl -w
    22###
    3 ### importpo.pl - Import the translation from the tarball downloaded
    4 ### from Launchpad.
     3### poimport.pl - Import the translation from the tarball downloaded
     4###     from Launchpad.
    55
    66use strict;
     
    88use Cwd;
    99use File::Spec::Functions;
     10use File::Basename;
    1011
    11 ### Name of the tarball downloaded from Launchpad.
     12### Name of the tarball downloaded from Launchpad.  Or download URL.
     13### Or JOSM translation branch revision number.
    1214my $tarball = "launchpad-export.tar.gz";
    13 ### Temporary directory.
     15#$tarball = "http://launchpadlibrarian.net/159932691/launchpad-export.tar.gz";
     16#$tarball = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/tarball/747";
     17#$tarball = "747";
     18### Temporary directory.  A unique directory name that is not used for
     19### anything else.
    1420my $workdir = "importpo";
    1521### Remove the temp. directory after the work is done (0/1)?
     
    1925my $podir = "po";
    2026
     27### Check for arguments.  The only supported argument is the tarball.
     28if ($#ARGV == 0) {
     29  $tarball = $ARGV[0];
     30}
     31elsif ($#ARGV > 0) {
     32  die "This script accepts only one argument.\n";
     33}
     34
     35### Check for JOSM translation branch revision number.
     36if ($tarball =~ m/^\d+$/) {
     37  $tarball = "http://bazaar.launchpad.net/~openstreetmap/josm/josm_trans/"
     38    . "tarball/" . $tarball;
     39}
     40
     41### Check if tarball is a URL and download it.  The downloaded file
     42### will not be removed and is available for a second import.
     43my $downurl;
     44if ($tarball =~ m,^http://.+/([^/]+)$,) {
     45  ### URL: Download file.
     46  $downurl = $tarball;
     47  my $downfile = $1;
     48  if ($downfile =~ m/^\d+$/) {
     49    ### Download of revision number.
     50    if ($tarball =~ m:/([^/]+)/tarball/(\d+)$:) {
     51      $downfile = $1 . "_" . $2 . ".tar.gz";
     52    }
     53    else {
     54      $downfile .= ".tar.gz";
     55    }
     56  }
     57  print "Will download file $downfile from $downurl.\n";
     58  system("wget -O $downfile $downurl") == 0 or die "wget failed: $?";
     59  $tarball = $downfile;
     60}
     61
    2162die "Tarball $tarball not found.\n" if (! -r $tarball);
    2263if (! -d $workdir) {
    23   mkdir $workdir or die "Failed to create directory $workdir: $!";
     64  mkdir $workdir or die "Failed to create work directory $workdir: $!";
    2465}
    2566copy($tarball, $workdir);
    2667my $startdir = getcwd();
    2768chdir $workdir;
    28 system "tar -xf $tarball";
    29 foreach my $lpponame (split("\n", `find po -name "*.po"`)) {
    30   if ($lpponame =~ /([a-zA-Z_]+\.po)/) {
    31     my $poname = $1;
     69my $tarballfile = basename($tarball);
     70system "tar -xf $tarballfile";
     71print "Copy language files:";
     72foreach my $lpponame (split("\n", `find . -name "*.po"`)) {
     73  if ($lpponame =~ /([a-zA-Z_@]+)\.po/) {
     74    my $lang = $1;
     75    my $poname = $1 . ".po";
     76    print " $lang";
    3277    copy($lpponame, catfile($startdir, $podir, $poname));
    3378  }
    3479}
     80print "\n";
    3581
    3682if ($rmworkdir) {
Note: See TracChangeset for help on using the changeset viewer.