Changeset 13392 in osm


Ignore:
Timestamp:
2009-01-26T10:35:02+01:00 (16 years ago)
Author:
skela
Message:

i18n/conv*.pl: Generate Java code that compiles.

Location:
applications/editors/josm/i18n
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/i18n/convpreset.pl

    r13140 r13392  
    1313# but it works with a default Perl installation
    1414
     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_preset { void tr(String s){} void f() {";
     18
    1519while(my $line = <>)
    1620{
     
    1822  if($line =~ /<item\s+name=(".*?")/)
    1923  {
    20     print "tr($1) /* item $item */\n";
     24    print "tr($1); /* item $item */\n";
    2125    $item = $group ? "$group$1" : $1;
    2226    $item =~ s/""/\//;
     
    2529  {
    2630    $group = $1;
    27     print "tr($1) /* group $group */\n";
     31    print "tr($1); /* group $group */\n";
    2832  }
    2933  elsif($line =~ /<label\s+text=" "/)
     
    3337  elsif($line =~ /<label\s+text=(".*?")/)
    3438  {
    35     print "tr($1) /* item $item label $1 */\n";
     39    print "tr($1); /* item $item label $1 */\n";
    3640  }
    3741  elsif($line =~ /<text.*text=(".*?")/)
    3842  {
    3943    my $n = $1;
    40     print "tr($n) /* item $item text $n */\n";
     44    print "tr($n); /* item $item text $n */\n";
    4145  }
    4246  elsif($line =~ /<check.*text=(".*?")/)
    4347  {
    4448    my $n = $1;
    45     print "tr($n) /* item $item check $n */\n";
     49    print "tr($n); /* item $item check $n */\n";
    4650  }
    4751  # first handle display values
     
    4953  {
    5054    my ($n,$vals) = ($1,$2);
    51     print "tr($n) /* item $item combo $n */";
     55    print "tr($n); /* item $item combo $n */";
    5256    foreach my $val (split ",",$vals)
    5357    {
    5458      next if $val =~ /^[0-9-]+$/; # search for non-numbers
    55       print " tr(\"$val\")";
     59      print " tr(\"$val\");";
    5660    }
    5761    print "\n";
     
    6064  {
    6165    my ($n,$vals) = ($1,$2);
    62     print "tr($n) /* item $item combo $n */";
     66    print "tr($n); /* item $item combo $n */";
    6367    foreach my $val (split ",",$vals)
    6468    {
    6569      next if $val =~ /^[0-9-]+$/; # search for non-numbers
    66       print " tr(\"$val\")";
     70      print " tr(\"$val\");";
    6771    }
    6872    print "\n";
     
    100104  $comment = 0 if($line =~ /-->/);
    101105}
     106
     107print "}}\n";
  • applications/editors/josm/i18n/convstyle.pl

    r13385 r13392  
    99# but it works with a default Perl installation
    1010
     11# Print a header to write valid Java code.  No line break,
     12# so that the input and output line numbers will match.
     13print "class trans_style { void tr(String s){} void f() {";
     14
    1115while(my $line = <>)
    1216{
     
    1418  if($line =~ /<rules\s+name=(".*?")/)
    1519  {
    16     print "tr($1) /* mappaint style named $1 */\n";
     20    print "tr($1); /* mappaint style named $1 */\n";
    1721  }
    1822  elsif($line =~ /colour="([^"]+)#/)
    1923  {
    20     print "tr(\"$1\") /* color $1 */\n";
     24    print "tr(\"$1\"); /* color $1 */\n";
    2125  }
    2226  else
     
    2529  }
    2630}
     31
     32print "}}\n";
  • applications/editors/josm/i18n/convsurveyor.pl

    r12484 r13392  
    1111# This is a simple conversion and in no way a complete XML parser
    1212# but it works with a default Perl installation
     13
     14# Print a header to write valid Java code.  No line break,
     15# so that the input and output line numbers will match.
     16print "class trans_surveyor { void tr(String s){} void f() {";
    1317
    1418while(my $line = <>)
     
    2529  elsif($line =~ /<button label=\"(.*?)\"/)
    2630  {
    27     print "tr(\"$1\") // $_\n";
     31    print "tr(\"$1\"); // $line\n";
    2832  }
    2933  else
     
    3236  }
    3337}
     38
     39print "}}\n";
  • applications/editors/josm/i18n/convvalidator.pl

    r11529 r13392  
    1111# This is a simple conversion and in no way a complete XML parser
    1212# but it works with a default Perl installation
     13
     14# Print a header to write valid Java code.  No line break,
     15# so that the input and output line numbers will match.
     16print "class trans_validator { void tr(String s){} void f() {";
    1317
    1418while(my $line = <>)
     
    2529  elsif($line =~ /(.*) *# *(.*) *$/)
    2630  {
    27     print "tr(\"$2\") // $1\n";
     31    print "tr(\"$2\"); // $1\n";
    2832  }
    2933  else
     
    3236  }
    3337}
     38
     39print "}}\n";
  • applications/editors/josm/i18n/convwms.pl

    r12334 r13392  
    1111# This is a simple conversion and in no way a complete XML parser
    1212# but it works with a default Perl installation
     13
     14# Print a header to write valid Java code.  No line break,
     15# so that the input and output line numbers will match.
     16print "class trans_wms { void tr(String s){} void f() {";
    1317
    1418while(my $line = <>)
     
    2529  elsif($line =~ /^(.*?);(.*?);(.*)$/)
    2630  {
    27     print "tr(\"$2\") // $3\n";
     31    print "tr(\"$2\"); // $3\n";
    2832  }
    2933  else
     
    3236  }
    3337}
     38
     39print "}}\n";
Note: See TracChangeset for help on using the changeset viewer.