Changeset 32241 in osm for applications


Ignore:
Timestamp:
2016-06-14T21:33:04+02:00 (9 years ago)
Author:
stoecker
Message:

output chunk id in translators text

File:
1 edited

Legend:

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

    r31901 r32241  
    77
    88my $item = "";
     9my $chunk = "";
    910my $group;
    1011my $combo_n;
     
    3132}
    3233
     34sub 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
    3344my $linenr = 0;
    3445while(my $line = <>)
     
    4455    if($line =~ /name_context=(".*?")/)
    4556    {
    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);
    5267  }
    5368  elsif($line =~ /<group.*\s+name=(".*?")/)
     
    5873    if($line =~ /name_context=(".*?")/)
    5974    {
    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";
    6580    }
    6681  }
    6782  elsif($line =~ /<label.*\s+text=" "/)
    6883  {
    69     print "/* item $item empty label */\n";
     84    print infoblock("empty label") . "\n";
    7085  }
    7186  elsif($line =~ /<label.*\s+text=(".*?")/)
     
    7489    if($line =~ /text_context=(".*?")/)
    7590    {
    76       print "/* item $item label $text */ trc($1,$text);\n";
    77     }
    78     else
    79     {
    80       print "/* item $item label $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";
    8196    }
    8297  }
     
    86101    if($line =~ /text_context=(".*?")/)
    87102    {
    88       print "/* item $item text $n */ trc($1,$n);\n";
    89     }
    90     else
    91     {
    92       print "/* item $item text $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";
    93108    }
    94109  }
     
    98113    if($line =~ /text_context=(".*?")/)
    99114    {
    100       print "/* item $item check $n */ trc($1,$n);\n";
    101     }
    102     else
    103     {
    104       print "/* item $item check $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";
    105120    }
    106121  }
     
    110125    if($line =~ /text_context=(".*?")/)
    111126    {
    112       print "/* item $item role $n */ trc($1,$n);\n";
    113     }
    114     else
    115     {
    116       print "/* item $item role $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";
    117132    }
    118133  }
     
    122137    if($line =~ /text_context=(".*?")/)
    123138    {
    124       print "/* item $item optional $n */ trc($1,$n);\n";
    125     }
    126     else
    127     {
    128       print "/* item $item optional $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";
    129144    }
    130145  }
     
    137152    # text
    138153    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);");
    140155    # display_values / values
    141156    my $sp = ($line =~ /delimiter="(.*?)"/) ? $1 : ($type eq "combo" ? ",":";");
     
    149164        next if $val =~ /^[0-9-]+$/; # search for non-numbers
    150165        $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\");");
    152167      }
    153168    }
     
    161176    {
    162177      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);");
    164179    }
    165180    else
    166181    {
    167182      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);");
    169184    }
    170185    if($line =~ /short_description=(".*?")/)
    171186    {
    172187      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);";
    174189    }
    175190    print "\n";
     
    184199    $item = "";
    185200    print "\n";
     201  }
     202  elsif($line =~ /<\/chunk>/)
     203  {
     204    $chunk = "";
    186205  }
    187206  elsif($line =~ /<\/(combo|multiselect)/)
Note: See TracChangeset for help on using the changeset viewer.