Changeset 13216 in josm for trunk


Ignore:
Timestamp:
2017-12-17T22:31:30+01:00 (7 years ago)
Author:
Don-vip
Message:

see #15606 - i18n fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java

    r13210 r13216  
    7777     */
    7878    public ExportRelationToGpxAction(EnumSet<Mode> mode) {
    79         super(tr("{0} starting from {1} member",
    80                  mode.contains(TO_FILE) ? tr("Export GPX file") : tr("Convert to GPX layer"),
    81                  mode.contains(FROM_FIRST_MEMBER) ? tr("first") : tr("last")),
    82               mode.contains(TO_FILE) ? "exportgpx" : "dialogs/layerlist",
    83               tr("Flatten this relation to a single gpx track "+
    84                  "recursively, starting with the {0} member(s), "+
    85                  "successively continuing to the {1}.",
    86                  mode.contains(FROM_FIRST_MEMBER) ? tr("first") : tr("last"),
    87                  mode.contains(FROM_FIRST_MEMBER) ? tr("last") : tr("first")),
    88               null, false, null, false);
     79        super(name(mode), mode.contains(TO_FILE) ? "exportgpx" : "dialogs/layerlist", tooltip(mode),
     80                null, false, null, false);
    8981        putValue("help", ht("/Action/ExportRelationToGpx"));
    9082        this.mode = mode;
     83    }
     84
     85    private static String name(EnumSet<Mode> mode) {
     86        if (mode.contains(TO_FILE)) {
     87            if (mode.contains(FROM_FIRST_MEMBER)) {
     88                return tr("Export GPX file starting from first member");
     89            } else {
     90                return tr("Export GPX file starting from last member");
     91            }
     92        } else {
     93            if (mode.contains(FROM_FIRST_MEMBER)) {
     94                return tr("Convert to GPX layer starting from first member");
     95            } else {
     96                return tr("Convert to GPX layer starting from last member");
     97            }
     98        }
     99    }
     100
     101    private static String tooltip(EnumSet<Mode> mode) {
     102        if (mode.contains(FROM_FIRST_MEMBER)) {
     103            return tr("Flatten this relation to a single gpx track recursively, " +
     104                    "starting with the first member(s), successively continuing to the last.");
     105        } else {
     106            return tr("Flatten this relation to a single gpx track recursively, " +
     107                    "starting with the last member(s), successively continuing to the first.");
     108        }
    91109    }
    92110
     
    163181            trk.add(trkseg);
    164182
    165             //RelationSorter.sortMembersByConnectivity(defaultMembers); // preserve given order
    166183            List<WayConnectionType> wct = new WayConnectionTypeCalculator().updateLinks(flat);
    167184            final HashMap<String, Integer> names = new HashMap<>();
     
    176193                            trk.add(trkseg);
    177194                        }
    178                         if (trkAttr.isEmpty()/* && (!wct.get(i).linkNext || (i+1 == flat.size()))*/) {
     195                        if (trkAttr.isEmpty()) {
    179196                            Relation r = Way.getParentRelations(Arrays.asList(flat.get(i).getWay()))
    180197                                    .stream().filter(relsFound::contains).findFirst().orElseGet(null);
     
    201218        }
    202219
    203         //Relation debug = new Relation(); debug.setMembers(flat);
    204         //MainApplication.getLayerManager().getEditDataSet().addPrimitive(debug);
    205220        return new GpxLayer(gpxData, layerName, true);
    206221    }
Note: See TracChangeset for help on using the changeset viewer.