Changeset 30137 in osm
- Timestamp:
- 2013-12-19T17:04:32+01:00 (11 years ago)
- 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 59 59 <target name="gettext-init" description="Loads the Ant gettext and contrib tasks."> 60 60 <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}"/>62 61 </target> 63 62 <target name="pot" description="Extract translatable strings from source." depends="gettext-init"> 64 63 <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"> 66 65 <fileset dir="src" includes="**/*.java"/> 67 66 </gettext-extract> 67 <echo file="po/${ant.project.name}.pot" append="true"> 68 #. Plugin ${ant.project.name} 69 #: build.xml:1 70 msgid "${plugin.description}" 71 msgstr "" 72 </echo> 68 73 </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> 71 78 </target> 72 79 <target name="poimport" description="Import the PO files from the tarball launchpad-export.tar.gz exported from Launchpad."> 73 80 <exec executable="perl"> 74 <arg line=" importpo.pl"/>81 <arg line="poimport.pl"/> 75 82 </exec> 76 83 </target> -
applications/editors/josm/plugins/photoadjust/poimport.pl
r30130 r30137 1 1 #! /usr/bin/perl -w 2 2 ### 3 ### importpo.pl - Import the translation from the tarball downloaded4 ### from Launchpad. 3 ### poimport.pl - Import the translation from the tarball downloaded 4 ### from Launchpad. 5 5 6 6 use strict; … … 8 8 use Cwd; 9 9 use File::Spec::Functions; 10 use File::Basename; 10 11 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. 12 14 my $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. 14 20 my $workdir = "importpo"; 15 21 ### Remove the temp. directory after the work is done (0/1)? … … 19 25 my $podir = "po"; 20 26 27 ### Check for arguments. The only supported argument is the tarball. 28 if ($#ARGV == 0) { 29 $tarball = $ARGV[0]; 30 } 31 elsif ($#ARGV > 0) { 32 die "This script accepts only one argument.\n"; 33 } 34 35 ### Check for JOSM translation branch revision number. 36 if ($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. 43 my $downurl; 44 if ($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 21 62 die "Tarball $tarball not found.\n" if (! -r $tarball); 22 63 if (! -d $workdir) { 23 mkdir $workdir or die "Failed to create directory $workdir: $!"; 64 mkdir $workdir or die "Failed to create work directory $workdir: $!"; 24 65 } 25 66 copy($tarball, $workdir); 26 67 my $startdir = getcwd(); 27 68 chdir $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; 69 my $tarballfile = basename($tarball); 70 system "tar -xf $tarballfile"; 71 print "Copy language files:"; 72 foreach 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"; 32 77 copy($lpponame, catfile($startdir, $podir, $poname)); 33 78 } 34 79 } 80 print "\n"; 35 81 36 82 if ($rmworkdir) {
Note:
See TracChangeset
for help on using the changeset viewer.