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

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

strip the additional text output for WMS

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