- Timestamp:
- 2009-10-03T13:56:26+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/presets/presets.xml
r2207 r2230 35 35 text: fixed label to display 36 36 values: comma seperated list of values 37 display_values: comma seperated list of values to be displayed instead of the 38 database values, order and number must be equal to values 37 39 default: default string to display 38 40 delete_if_empty: true/false … … 53 55 54 56 See also http://josm.openstreetmap.de/wiki/TaggingPresets. 57 58 The fields "name", "text", "display_values" may also be localized (e.g. de.name). 59 When translations of equal words but different meanings may conflict, a translation 60 context should be specified. Use "name_conext", "text_context" or "values_context" 61 for this. The context should be a meaningful short description to help translators. 62 63 In JOSM internally all "name", "text" and "display_values" are translated when 64 no specific translation has been given in XML file. When no "display_values" 65 are supplied, then "values" will be treated as "display_values" and translated instead. 55 66 --> 56 67 <annotations> … … 1367 1378 <text key="name" text="Name" default="" delete_if_empty="true" /> 1368 1379 </item> 1369 <item name="Station" icon="presets/aerialway_station.png" type="node,closedway">1380 <item name="Station" name_context="aerialway" icon="presets/aerialway_station.png" type="node,closedway"> 1370 1381 <link href="http://wiki.openstreetmap.org/wiki/Proposed_features/Piste_Maps" /> 1371 <label text="Edit Station" />1382 <label text="Edit Station" text_context="aerialway" /> 1372 1383 <key key="aerialway" value="station" /> 1373 1384 <text key="name" text="Name" default="" delete_if_empty="true" /> … … 1462 1473 </group> <!-- Bicycle --> 1463 1474 <group name="Public Transport" icon="presets/bus.png"> 1464 <item name="Station" icon="presets/station.png" type="node,closedway">1475 <item name="Station" name_context="railway" icon="presets/station.png" type="node,closedway"> 1465 1476 <link href="http://wiki.openstreetmap.org/wiki/Tag:railway=station" 1466 1477 de.href="http://wiki.openstreetmap.org/wiki/DE:Tag:railway=station" /> 1467 <label text="Edit Station" />1478 <label text="Edit Station" text_context="railway" /> 1468 1479 <space /> 1469 1480 <key key="railway" value="station" /> -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r2193 r2230 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 import static org.openstreetmap.josm.tools.I18n.trc; 6 7 import static org.openstreetmap.josm.tools.I18n.trn; 7 8 … … 68 69 public TaggingPresetMenu group = null; 69 70 public String name; 71 public String name_context; 70 72 public String locale_name; 71 73 … … 141 143 public String text; 142 144 public String locale_text; 145 public String text_context; 143 146 public String default_; 144 147 public String originalValue; … … 178 181 } 179 182 if(locale_text == null) { 180 locale_text = tr(text); 183 if(text_context != null) 184 locale_text = trc(text_context, text); 185 else 186 locale_text = tr(text); 181 187 } 182 188 p.add(new JLabel(locale_text+":"), GBC.std().insets(0,0,10,0)); … … 209 215 public String key; 210 216 public String text; 217 public String text_context; 211 218 public String locale_text; 212 219 public boolean default_ = false; // only used for tagless objects … … 224 231 225 232 if(locale_text == null) { 226 locale_text = tr(text); 233 if(text_context != null) 234 locale_text = trc(text_context, text); 235 else 236 locale_text = tr(text); 227 237 } 228 238 … … 287 297 public String key; 288 298 public String text; 299 public String text_context; 289 300 public String locale_text; 290 301 public String values; 302 public String values_context; 291 303 public String display_values; 292 304 public String locale_display_values; … … 321 333 } 322 334 for (int i=0; i<value_array.length; i++) { 323 lhm.put(value_array[i], 324 (locale_display_values == null) ?325 tr(display_array[i]) : display_array[i]);335 lhm.put(value_array[i], (locale_display_values == null) 336 ? (values_context == null ? tr(display_array[i]) 337 : tr(values_context, display_array[i])) : display_array[i]); 326 338 } 327 339 if(!usage.unused()){ … … 365 377 366 378 if(locale_text == null) { 367 locale_text = tr(text); 379 if(text_context != null) 380 locale_text = trc(text_context, text); 381 else 382 locale_text = tr(text); 368 383 } 369 384 p.add(new JLabel(locale_text+":"), GBC.std().insets(0,0,10,0)); … … 407 422 public static class Label extends Item { 408 423 public String text; 424 public String text_context; 409 425 public String locale_text; 410 426 411 427 @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 412 428 if(locale_text == null) { 413 locale_text = tr(text); 429 if(text_context != null) 430 locale_text = trc(text_context, text); 431 else 432 locale_text = tr(text); 414 433 } 415 434 p.add(new JLabel(locale_text), GBC.eol()); … … 422 441 public String href; 423 442 public String text; 443 public String text_context; 424 444 public String locale_text; 425 445 public String locale_href; … … 427 447 @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 428 448 if(locale_text == null) { 429 locale_text = text == null ? tr("More information about this feature") : tr(text); 449 if(text == null) 450 locale_text = tr("More information about this feature"); 451 if(text_context != null) 452 locale_text = trc(text_context, text); 453 else 454 locale_text = tr(text); 430 455 } 431 456 String url = locale_href; … … 500 525 public String getLocaleName() { 501 526 if(locale_name == null) { 502 locale_name = tr(name); 527 if(name_context != null) 528 locale_name = trc(name_context, name); 529 else 530 locale_name = tr(name); 503 531 } 504 532 return locale_name;
Note:
See TracChangeset
for help on using the changeset viewer.