Changeset 32241 in osm for applications
- Timestamp:
- 2016-06-14T21:33:04+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/i18n/convpreset.pl
r31901 r32241 7 7 8 8 my $item = ""; 9 my $chunk = ""; 9 10 my $group; 10 11 my $combo_n; … … 31 32 } 32 33 34 sub infoblock 35 { 36 my $r = ""; 37 $r .= " item $item" if $item; 38 $r .= " chunk $chunk" if $chunk; 39 $r .= " group $group" if $group; 40 $r .= " $_[0]" if $_[0]; 41 return $r ? "/* $r */ " : ""; 42 } 43 33 44 my $linenr = 0; 34 45 while(my $line = <>) … … 44 55 if($line =~ /name_context=(".*?")/) 45 56 { 46 print "/* item $item */ trc($1, $val);\n"; 47 } 48 else 49 { 50 print "/* item $item */ tr($val);\n"; 51 } 57 print infoblock() . "trc($1, $val);\n"; 58 } 59 else 60 { 61 print infoblock() . "tr($val);\n"; 62 } 63 } 64 if($line =~ /<chunk\s+id=(".*?")/) 65 { 66 $chunk = fix($1); 52 67 } 53 68 elsif($line =~ /<group.*\s+name=(".*?")/) … … 58 73 if($line =~ /name_context=(".*?")/) 59 74 { 60 print "/* group $group */trc($1,$gr);\n";61 } 62 else 63 { 64 print "/* group $group */tr($gr);\n";75 print infoblock() . "trc($1,$gr);\n"; 76 } 77 else 78 { 79 print infoblock() . "tr($gr);\n"; 65 80 } 66 81 } 67 82 elsif($line =~ /<label.*\s+text=" "/) 68 83 { 69 print "/* item $itemempty label*/\n";84 print infoblock("empty label") . "\n"; 70 85 } 71 86 elsif($line =~ /<label.*\s+text=(".*?")/) … … 74 89 if($line =~ /text_context=(".*?")/) 75 90 { 76 print "/* item $itemlabel $text*/trc($1,$text);\n";77 } 78 else 79 { 80 print "/* item $itemlabel $text*/tr($text);\n";91 print infoblock("label $text") ."trc($1,$text);\n"; 92 } 93 else 94 { 95 print infoblock("label $text") . "tr($text);\n"; 81 96 } 82 97 } … … 86 101 if($line =~ /text_context=(".*?")/) 87 102 { 88 print "/* item $itemtext $n*/trc($1,$n);\n";89 } 90 else 91 { 92 print "/* item $itemtext $n*/tr($n);\n";103 print infoblock("text $n") . "trc($1,$n);\n"; 104 } 105 else 106 { 107 print infoblock("text $n") . "tr($n);\n"; 93 108 } 94 109 } … … 98 113 if($line =~ /text_context=(".*?")/) 99 114 { 100 print "/* item $itemcheck $n*/trc($1,$n);\n";101 } 102 else 103 { 104 print "/* item $itemcheck $n*/tr($n);\n";115 print infoblock("check $n") . "trc($1,$n);\n"; 116 } 117 else 118 { 119 print infoblock("check $n") . "tr($n);\n"; 105 120 } 106 121 } … … 110 125 if($line =~ /text_context=(".*?")/) 111 126 { 112 print "/* item $itemrole $n*/trc($1,$n);\n";113 } 114 else 115 { 116 print "/* item $itemrole $n*/tr($n);\n";127 print infoblock("role $n") . "trc($1,$n);\n"; 128 } 129 else 130 { 131 print infoblock("role $n") . "tr($n);\n"; 117 132 } 118 133 } … … 122 137 if($line =~ /text_context=(".*?")/) 123 138 { 124 print "/* item $itemoptional $n*/trc($1,$n);\n";125 } 126 else 127 { 128 print "/* item $itemoptional $n*/tr($n);\n";139 print infoblock("optional $n") . "trc($1,$n);\n"; 140 } 141 else 142 { 143 print infoblock("optional $n") . "tr($n);\n"; 129 144 } 130 145 } … … 137 152 # text 138 153 my $tctx = ($line =~ /text_context=(".*?")/) ? $1 : undef; 139 print "/* item $item$type $n*/". ($tctx ? " trc($tctx, $n);" : " tr($n);");154 print infoblock("$type $n") . ($tctx ? " trc($tctx, $n);" : " tr($n);"); 140 155 # display_values / values 141 156 my $sp = ($line =~ /delimiter="(.*?)"/) ? $1 : ($type eq "combo" ? ",":";"); … … 149 164 next if $val =~ /^[0-9-]+$/; # search for non-numbers 150 165 $val = fix($val); 151 print "/* item $item$type $n display value*/". ($vctx ? " trc($vctx, \"$val\");" : " tr(\"$val\");");166 print infoblock("$type $n display value") . ($vctx ? " trc($vctx, \"$val\");" : " tr(\"$val\");"); 152 167 } 153 168 } … … 161 176 { 162 177 my $val = fix($1); 163 print "/* item $item$combo_type $combo_n entry $value display value*/". ($vctxi ? " trc($vctxi, $val);" : " tr($val);");178 print infoblock("$combo_type $combo_n entry $value display value") . ($vctxi ? " trc($vctxi, $val);" : " tr($val);"); 164 179 } 165 180 else 166 181 { 167 182 my $val = fix($value); 168 print "/* item $item$combo_type $combo_n entry $value display value*/". ($vctxi ? " trc($vctxi, $val);" : " tr($val);");183 print infoblock("$combo_type $combo_n entry $value display value") . ($vctxi ? " trc($vctxi, $val);" : " tr($val);"); 169 184 } 170 185 if($line =~ /short_description=(".*?")/) 171 186 { 172 187 my $val = fix($1); 173 print "/* item $item$combo_type $combo_n entry $value short description*/tr($val);";188 print infoblock("$combo_type $combo_n entry $value short description") . "tr($val);"; 174 189 } 175 190 print "\n"; … … 184 199 $item = ""; 185 200 print "\n"; 201 } 202 elsif($line =~ /<\/chunk>/) 203 { 204 $chunk = ""; 186 205 } 187 206 elsif($line =~ /<\/(combo|multiselect)/)
Note:
See TracChangeset
for help on using the changeset viewer.