source: osm/applications/editors/josm/i18n/convwiki.pl@ 32516

Last change on this file since 32516 was 31111, checked in by stoecker, 10 years ago

major speedup of i18n process, add some new features, split core translations into two parts

File size: 1.3 KB
Line 
1#! /usr/bin/perl -w
2
3# Written by Dirk Stöcker <openstreetmap@dstoecker.de>
4# Public domain, no rights reserved.
5
6use strict;
7use LWP::Simple;
8use open qw/:std :encoding(utf8)/;
9
10my $filename;
11my $dir = $ARGV[1] || "build/josmfiles";
12if($ARGV[0] && $ARGV[0] =~ /^http:\/\//)
13{
14 $filename = $ARGV[2] || "build/josmfiles.zip";
15 my $content = get($ARGV[0]);
16 die "Couldn't get $ARGV[0]" unless defined $content;
17 open FILE,">:raw",$filename or die "Could not open $filename";
18 print FILE $content;
19 close FILE
20}
21else
22{
23 $filename = $ARGV[0];
24}
25system "rm -rf $dir/";
26print "Extracting to $dir\n";
27mkdir $dir;
28system "unzip -q -d $dir $filename";
29foreach my $name (glob "$dir/*")
30{
31 if($name =~ /^(.*?)([^\/]+-preset\.xml)$/)
32 {
33 system "mv $name $name.orig";
34 my ($path, $xmlname) = ($1, $2);
35 my $res = `xmllint --format --schema ../core/data/tagging-preset.xsd $name.orig --encode utf-8 --output $name 2>&1`;
36 print $res if $res !~ /\.orig validates/;
37 system "perl convpreset.pl $name >${path}trans_$xmlname";
38 unlink "$name.orig";
39 }
40 elsif($name =~ /^(.*?)([^\/]+-style\.xml$)/)
41 {
42 system "perl convstyle.pl $name >${1}trans_$2";
43 }
44 elsif($name =~ /^(.*?)([^\/]+\.mapcss)$/)
45 {
46 system "perl convcss.pl $name >${1}trans_$2";
47 }
48 else
49 {
50 die "Unknown file type $name.";
51 }
52 unlink $name;
53}
Note: See TracBrowser for help on using the repository browser.