Changeset 30137 in osm


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

Update of translation chain. Added translated languages.

Location:
applications/editors/josm/plugins/photoadjust
Files:
6 added
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photoadjust/build.xml

    r30130 r30137  
    5959    <target name="gettext-init" description="Loads the Ant gettext and contrib tasks.">
    6060        <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
    61         <taskdef name="gettext-merge" classname="org.xnap.commons.ant.gettext.GettextMergeKeysTask" classpath="${gettexttasks.jar}"/>
    6261    </target>
    6362    <target name="pot" description="Extract translatable strings from source." depends="gettext-init">
    6463        <mkdir dir="po"/>
    65         <gettext-extract keysFile="photoadjust.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
     64        <gettext-extract keysFile="${ant.project.name}.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
    6665            <fileset dir="src" includes="**/*.java"/>
    6766        </gettext-extract>
     67        <echo file="po/${ant.project.name}.pot" append="true">
     68#. Plugin ${ant.project.name}
     69#: build.xml:1
     70msgid "${plugin.description}"
     71msgstr ""
     72</echo>
    6873    </target>
    69     <target name="pomerge" description="Merge extracted strings into language files." depends="gettext-init">
    70         <gettext-merge keysFile="photoadjust.pot" poDirectory="po"/>
     74    <target name="pomerge" description="Merge extracted strings into language files.">
     75        <exec executable="perl">
     76            <arg line="pomerge.pl"/>
     77        </exec>
    7178    </target>
    7279    <target name="poimport" description="Import the PO files from the tarball launchpad-export.tar.gz exported from Launchpad.">
    7380        <exec executable="perl">
    74             <arg line="importpo.pl"/>
     81            <arg line="poimport.pl"/>
    7582        </exec>
    7683    </target>
  • 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.