Changeset 26180 in osm for applications/editors
- Timestamp:
- 2011-06-25T23:37:12+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/i18n/convpreset.pl
r25155 r26180 21 21 print "class trans_preset { void tr(String s){} void f() {"; 22 22 23 sub fix($) 24 { 25 my ($val) = @_; 26 $val =~ s/'/''/g; 27 return $val; 28 } 29 23 30 while(my $line = <>) 24 31 { … … 26 33 if($line =~ /<item\s+name=(".*?")/) 27 34 { 28 my $val = $1;35 my $val = fix($1); 29 36 $item = $group ? "$group$val" : $val; 30 37 $item =~ s/""/\//; … … 40 47 elsif($line =~ /<group.*\s+name=(".*?")/) 41 48 { 42 my $gr = $1;49 my $gr = fix($1); 43 50 $group = $group ? "$group$gr" : $gr; 44 51 $group =~ s/\"\"/\//; … … 58 65 elsif($line =~ /<label.*\s+text=(".*?")/) 59 66 { 60 my $text = $1;67 my $text = fix($1); 61 68 if($line =~ /text_context=(".*?")/) 62 69 { … … 70 77 elsif($line =~ /<text.*\s+text=(".*?")/) 71 78 { 72 my $n = $1;79 my $n = fix($1); 73 80 if($line =~ /text_context=(".*?")/) 74 81 { … … 82 89 elsif($line =~ /<check.*\s+text=(".*?")/) 83 90 { 84 my $n = $1;91 my $n = fix($1); 85 92 if($line =~ /text_context=(".*?")/) 86 93 { … … 94 101 elsif($line =~ /<role.*\s+text=(".*?")/) 95 102 { 96 my $n = $1;103 my $n = fix($1); 97 104 if($line =~ /text_context=(".*?")/) 98 105 { … … 107 114 elsif($line =~ /<(combo|multiselect).*\s+text=(".*?").*\s+display_values="(.*?)"/) 108 115 { 109 my ($type,$n,$vals) = ($1, $2,$3);116 my ($type,$n,$vals) = ($1,fix($2),$3); 110 117 my $sp = ($type eq "combo" ? ",":";"); 111 118 $combo_n = $n; … … 122 129 $vals =~ s/\\$sp/\x91/g; 123 130 @combo_values = split $sp,$vals; 124 for (my $i=0; $i<@combo_values; ++$i) { 125 $combo_values[$i] =~ s/\x91/$sp/g; 126 next if $combo_values[$i] =~ /^[0-9-]+$/; # search for non-numbers 127 print "/* item $item $type $n display value */" . ($vctx ? " trc($vctx, \"$combo_values[$i]\");" : " tr(\"$combo_values[$i]\");"); 131 for (my $i=0; $i<@combo_values; ++$i) 132 { 133 my $val = $combo_values[$i]; 134 $val =~ s/\x91/$sp/g; 135 next if $val =~ /^[0-9-]+$/; # search for non-numbers 136 $val = fix($val); 137 print "/* item $item $type $n display value */" . ($vctx ? " trc($vctx, \"$val\");" : " tr(\"$val\");"); 128 138 } 129 139 print "\n"; … … 131 141 elsif($line =~ /<(combo|multiselect).*\s+text=(".*?").*\s+values="(.*?)"/) 132 142 { 133 my ($type,$n,$vals) = ($1, $2,$3);143 my ($type,$n,$vals) = ($1,fix($2),$3); 134 144 my $sp = ($type eq "combo" ? ",":";"); 135 145 $combo_n = $n; … … 148 158 { 149 159 next if $val =~ /^[0-9-]+$/; # search for non-numbers 160 $val = fix($val); 150 161 print "/* item $item $type $n display value */" . ($vctx ? " trc($vctx, \"$val\");" : " tr(\"$val\");"); 151 162 } … … 154 165 elsif(!$comment && $line =~ /<short_description>(.*?)<\/short_description>/) 155 166 { 156 my $n = $1;167 my $n = fix($1); 157 168 print "/* item $item combo $combo_n item \"$combo_values[$combo_idx]\" short description */ tr(\"$n\");\n"; 158 169 $combo_idx++;
Note:
See TracChangeset
for help on using the changeset viewer.