Subject: [PATCH] Different translation
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
a
|
b
|
|
1 | 1 | // License: GPL. For details, see LICENSE file. |
2 | 2 | package org.openstreetmap.josm.gui.dialogs.properties; |
3 | 3 | |
| 4 | import static org.openstreetmap.josm.actions.search.SearchAction.searchStateless; |
4 | 5 | import static org.openstreetmap.josm.tools.I18n.tr; |
5 | 6 | |
6 | 7 | import java.awt.Component; |
… |
… |
|
108 | 109 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetListener; |
109 | 110 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType; |
110 | 111 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| 112 | import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; |
111 | 113 | import org.openstreetmap.josm.gui.util.AbstractTag2LinkPopupListener; |
112 | 114 | import org.openstreetmap.josm.gui.util.HighlightHelper; |
113 | 115 | import org.openstreetmap.josm.gui.util.TableHelper; |
… |
… |
|
351 | 353 | tagRowSorter.setComparator(0, AlphanumComparator.getInstance()); |
352 | 354 | tagRowSorter.setComparator(1, (o1, o2) -> { |
353 | 355 | if (o1 instanceof Map && o2 instanceof Map) { |
354 | | final String v1 = ((Map) o1).size() == 1 ? (String) ((Map) o1).keySet().iterator().next() : tr("<different>"); |
355 | | final String v2 = ((Map) o2).size() == 1 ? (String) ((Map) o2).keySet().iterator().next() : tr("<different>"); |
| 356 | final String v1 = ((Map) o1).size() == 1 ? (String) ((Map) o1).keySet().iterator().next() : KeyedItem.DIFFERENT_I18N; |
| 357 | final String v2 = ((Map) o2).size() == 1 ? (String) ((Map) o2).keySet().iterator().next() : KeyedItem.DIFFERENT_I18N; |
356 | 358 | return AlphanumComparator.getInstance().compare(v1, v2); |
357 | 359 | } else { |
358 | 360 | return AlphanumComparator.getInstance().compare(String.valueOf(o1), String.valueOf(o2)); |
… |
… |
|
768 | 770 | } |
769 | 771 | tagData.addRow(new Object[]{e.getKey(), e.getValue()}); |
770 | 772 | tags.put(e.getKey(), e.getValue().size() == 1 |
771 | | ? e.getValue().keySet().iterator().next() : tr("<different>")); |
| 773 | ? e.getValue().keySet().iterator().next() : KeyedItem.DIFFERENT_I18N); |
772 | 774 | } |
773 | 775 | |
774 | 776 | presets.updatePresets(types, tags, presetHandler); |
… |
… |
|
1195 | 1197 | if (roleString == null) { |
1196 | 1198 | roleString = r.getRole(); |
1197 | 1199 | } else if (!roleString.equals(r.getRole())) { |
1198 | | roleString = tr("<different>"); |
| 1200 | roleString = KeyedItem.DIFFERENT_I18N; |
1199 | 1201 | break; |
1200 | 1202 | } |
1201 | 1203 | } |
… |
… |
|
1205 | 1207 | |
1206 | 1208 | @Override |
1207 | 1209 | public String toString() { |
1208 | | return "MemberInfo{" + |
1209 | | "roles='" + roleString + '\'' + |
1210 | | ", positions='" + positionString + '\'' + |
1211 | | '}'; |
| 1210 | return String.format("MemberInfo{roles='%s', positions='%s'}", roleString, positionString); |
1212 | 1211 | } |
1213 | 1212 | } |
1214 | 1213 | |
… |
… |
|
1461 | 1460 | if (sel.isEmpty()) |
1462 | 1461 | return; |
1463 | 1462 | final SearchSetting ss = createSearchSetting(key, sel, sameType); |
1464 | | org.openstreetmap.josm.actions.search.SearchAction.searchStateless(ss); |
| 1463 | searchStateless(ss); |
1465 | 1464 | } |
1466 | 1465 | } |
1467 | 1466 | |
… |
… |
|
1484 | 1483 | } else if (p instanceof Relation) { |
1485 | 1484 | t = "type:relation "; |
1486 | 1485 | } |
1487 | | String token = new StringBuilder(t).append(val).toString(); |
| 1486 | String token = t + val; |
1488 | 1487 | if (consideredTokens.add(token)) { |
1489 | 1488 | s.append(sep).append('(').append(t).append(SearchCompiler.buildSearchStringForTag(key, val)).append(')'); |
1490 | 1489 | sep = " OR "; |
… |
… |
|
1505 | 1504 | void removeHiddenSelection() { |
1506 | 1505 | try { |
1507 | 1506 | tagRowSorter.convertRowIndexToModel(tagTable.getSelectedRow()); |
1508 | | } catch (IndexOutOfBoundsException ignore) { |
1509 | | Logging.trace(ignore); |
| 1507 | } catch (IndexOutOfBoundsException e) { |
| 1508 | Logging.trace(e); |
1510 | 1509 | Logging.trace("Clearing tagTable selection"); |
1511 | 1510 | tagTable.clearSelection(); |
1512 | 1511 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/RelationRoleEditor.java b/src/org/openstreetmap/josm/gui/dialogs/properties/RelationRoleEditor.java
a
|
b
|
|
14 | 14 | import org.openstreetmap.josm.data.osm.Relation; |
15 | 15 | import org.openstreetmap.josm.data.osm.RelationMember; |
16 | 16 | import org.openstreetmap.josm.gui.MainApplication; |
| 17 | import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; |
17 | 18 | import org.openstreetmap.josm.tools.Utils; |
18 | 19 | |
19 | 20 | /** |
… |
… |
|
41 | 42 | formatter.formatAsHtmlUnorderedList(Utils.transform(members, RelationMember::getMember), 5), |
42 | 43 | formatter.formatAsHtmlUnorderedList(relation)), |
43 | 44 | oldRole); |
44 | | if (newRole == null || oldRole.equals(newRole) || tr("<different>").equals(newRole)) { |
| 45 | if (newRole == null || oldRole.equals(newRole) || KeyedItem.DIFFERENT_I18N.equals(newRole)) { |
45 | 46 | return; |
46 | 47 | } |
47 | 48 | final List<RelationMember> newMembers = relation.getMembers(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java b/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
a
|
b
|
|
88 | 88 | import org.openstreetmap.josm.gui.tagging.ac.AutoCompEvent; |
89 | 89 | import org.openstreetmap.josm.gui.tagging.ac.AutoCompListener; |
90 | 90 | import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; |
| 91 | import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; |
91 | 92 | import org.openstreetmap.josm.gui.util.GuiHelper; |
92 | 93 | import org.openstreetmap.josm.gui.util.WindowGeometry; |
93 | 94 | import org.openstreetmap.josm.gui.widgets.JosmListCellRenderer; |
… |
… |
|
537 | 538 | |
538 | 539 | List<AutoCompletionItem> valueList = autocomplete.getTagValues(getAutocompletionKeys(key), usedValuesAwareComparator); |
539 | 540 | |
540 | | final String selection = m.size() != 1 ? tr("<different>") : m.entrySet().iterator().next().getKey(); |
| 541 | final String selection = m.size() != 1 ? KeyedItem.DIFFERENT_I18N : m.entrySet().iterator().next().getKey(); |
541 | 542 | |
542 | 543 | values = new AutoCompComboBox<>(); |
543 | 544 | values.getModel().setComparator(Comparator.naturalOrder()); |
… |
… |
|
585 | 586 | newkey = key; |
586 | 587 | value = null; // delete the key instead |
587 | 588 | } |
588 | | if (key.equals(newkey) && tr("<different>").equals(value)) |
| 589 | if (key.equals(newkey) && KeyedItem.DIFFERENT_I18N.equals(value)) |
589 | 590 | return; |
590 | 591 | if (key.equals(newkey) || value == null) { |
591 | 592 | UndoRedoHandler.getInstance().add(new ChangePropertyCommand(sel, newkey, value)); |
… |
… |
|
605 | 606 | } |
606 | 607 | Collection<Command> commands = new ArrayList<>(); |
607 | 608 | commands.add(new ChangePropertyCommand(sel, key, null)); |
608 | | if (value.equals(tr("<different>"))) { |
| 609 | if (value.equals(KeyedItem.DIFFERENT_I18N)) { |
609 | 610 | String newKey = newkey; |
610 | 611 | sel.stream() |
611 | 612 | .filter(osm -> osm.hasKey(key)) |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/tagging/ac/MaxLengthDocumentFilter.java b/src/org/openstreetmap/josm/gui/tagging/ac/MaxLengthDocumentFilter.java
a
|
b
|
|
1 | 1 | // License: GPL. For details, see LICENSE file. |
2 | 2 | package org.openstreetmap.josm.gui.tagging.ac; |
3 | 3 | |
4 | | import static org.openstreetmap.josm.tools.I18n.tr; |
5 | | |
6 | 4 | import javax.swing.text.AttributeSet; |
7 | 5 | import javax.swing.text.BadLocationException; |
8 | 6 | import javax.swing.text.DocumentFilter; |
9 | 7 | import javax.swing.text.StyleConstants; |
10 | 8 | |
| 9 | import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; |
| 10 | |
11 | 11 | /** |
12 | 12 | * A {@link DocumentFilter} to limit the text length in the editor. |
13 | 13 | * @since 18221 |
… |
… |
|
15 | 15 | public class MaxLengthDocumentFilter extends DocumentFilter { |
16 | 16 | /** the document will not accept text longer than this. -1 to disable */ |
17 | 17 | private int maxLength = -1; |
18 | | private static final String DIFFERENT = tr("<different>"); |
19 | 18 | |
20 | 19 | /** |
21 | 20 | * Sets the maximum text length. |
22 | 21 | * |
23 | | * @param length the maximum no. of charactes allowed in this document. -1 to disable |
| 22 | * @param length the maximum no. of characters allowed in this document. -1 to disable |
24 | 23 | */ |
25 | 24 | public void setMaxLength(int length) { |
26 | 25 | maxLength = length; |
… |
… |
|
44 | 43 | |
45 | 44 | private boolean mustInsertOrReplace(FilterBypass fb, int length, String string, AttributeSet attr) { |
46 | 45 | int newLen = fb.getDocument().getLength() - length + ((string == null) ? 0 : string.length()); |
47 | | return (maxLength == -1 || newLen <= maxLength || DIFFERENT.equals(string) || |
| 46 | return (maxLength == -1 || newLen <= maxLength || KeyedItem.DIFFERENT_I18N.equals(string) || |
48 | 47 | // allow longer text while composing characters or it will be hard to compose |
49 | 48 | // the last characters before the limit |
50 | 49 | ((attr != null) && attr.isDefined(StyleConstants.ComposedTextAttribute))); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java
a
|
b
|
|
29 | 29 | /** The constant value {@code "<different>"}. */ |
30 | 30 | protected static final String DIFFERENT = "<different>"; |
31 | 31 | /** Translation of {@code "<different>"}. */ |
32 | | protected static final String DIFFERENT_I18N = tr(DIFFERENT); |
| 32 | public static final String DIFFERENT_I18N = tr("<different>"); |
33 | 33 | |
34 | 34 | /** True if the default value should also be set on primitives that already have tags. */ |
35 | 35 | protected static final BooleanProperty PROP_FILL_DEFAULT = new BooleanProperty("taggingpreset.fill-default-for-tagged-primitives", false); |