source: subversion/applications/editors/josm/i18n/convtag2link.pl @ 35032

Last change on this file since 35032 was 33143, checked in by Dirk Stoecker, 3 years ago

add tag2link translation parsing

File size: 956 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;
7
8my $item;
9my $src = "";
10my $country = "";
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_tag2link { void tr(String s){} void f() {";
19
20while(my $line = <>)
21{
22  chomp($line);
23  print "tr(\"---DUMMY-MARKER---\"); ";
24  if($line =~ /<link name="([^"]+)" /)
25  {
26    print "tr(\"$1\") /* src $src country code $country */\n";
27  }
28  elsif($line =~ /^$/)
29  {
30    print "\n";
31  }
32  else
33  {
34    if($line =~ /<src name="([^"]+)"  country-code="([^"]+)"/)
35    {
36      $src = $1; $country = $2;
37    }
38    elsif($line =~ /<\/src/)
39    {
40      $src = ""; $country = ""
41    }
42    print "/* $line */\n";
43  }
44}
45
46print "}}\n";
Note: See TracBrowser for help on using the repository browser.