source: osm/applications/editors/josm/i18n/convwms.pl@ 26589

Last change on this file since 26589 was 26589, checked in by stoecker, 13 years ago

adapt to new file format

File size: 787 bytes
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;
8
9my $item;
10my $comment = 0;
11
12# This is a simple conversion and in no way a complete XML parser
13# but it works with a default Perl installation
14
15# Print a header to write valid Java code. No line break,
16# so that the input and output line numbers will match.
17print "class trans_wms { void tr(String s){} void f() {";
18
19my @lines;
20if($ARGV[0] && $ARGV[0] =~ /^http:\/\//)
21{
22 @lines = split("\r?\n", get($ARGV[0]));
23}
24else
25{
26 @lines = <>;
27}
28
29for my $line (@lines)
30{
31 $line =~ s/\r//g;
32 chomp($line);
33 if($line =~ /<name>(.*)<\/name>/)
34 {
35 print "/* $line */ tr(\"$1\");\n";
36 }
37 else
38 {
39 print "/* $line */\n";
40 }
41}
42
43print "}}\n";
Note: See TracBrowser for help on using the repository browser.