Changeset 16067 in josm for trunk/src/org


Ignore:
Timestamp:
2020-03-08T09:03:32+01:00 (5 years ago)
Author:
simon04
Message:

fix #18821, see #18302 - TaginfoAction: improve i18n

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r15913 r16067  
    373373            final LatLon center = newSel.iterator().next().getBBox().getCenter();
    374374            Territories.getRegionalTaginfoUrls(center).stream()
    375                     .map(taginfo -> new TaginfoAction(
     375                    .map(taginfo -> new TaginfoAction(tr("Go to Taginfo ({0})", taginfo.toString()),
    376376                            tagTable, editHelper::getDataKey, editHelper::getDataValues,
    377                             membershipTable, x -> (IRelation<?>) membershipData.getValueAt(x, 0), taginfo.getUrl(),
    378                             String.join("/", taginfo.getIsoCodes()) + (taginfo.getSuffix() == null ? "" : " (" + taginfo.getSuffix() + ")"))
     377                            membershipTable, x -> (IRelation<?>) membershipData.getValueAt(x, 0), taginfo.getUrl())
    379378                    ).forEach(taginfoNationalActions::add);
    380379            taginfoNationalActions.stream().map(membershipMenu::add).forEach(membershipMenuTagInfoNatItems::add);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TaginfoAction.java

    r15565 r16067  
    4444    public TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier,
    4545            JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier) {
    46         this(tagTable, tagKeySupplier, tagValuesSupplier, membershipTable, memberValueSupplier, TAGINFO_URL_PROP.get(), null);
     46        this(tr("Go to Taginfo"), tagTable, tagKeySupplier, tagValuesSupplier, membershipTable, memberValueSupplier, TAGINFO_URL_PROP.get());
    4747    }
    4848
    4949    /**
    5050     * Constructs a new {@code TaginfoAction} with a given URL and optional name suffix.
     51     * @param name the action's text as displayed on the menu (if it is added to a menu)
    5152     * @param tagTable The tag table. Cannot be null
    5253     * @param tagKeySupplier Finds the key from given row of tag table. Cannot be null
     
    5556     * @param memberValueSupplier Finds the parent relation from given row of membership table. Can be null
    5657     * @param taginfoUrl Taginfo URL. Cannot be null
    57      * @param suffix Optional name suffix, can be null
    5858     * @since 15565
    5959     */
    60     public TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier,
    61             JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier, String taginfoUrl, String suffix) {
    62         super(tr("Go to Taginfo") + (suffix != null ? " " + suffix : ""), "dialogs/taginfo",
     60    public TaginfoAction(String name, JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier,
     61                         JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier, String taginfoUrl) {
     62        super(name, "dialogs/taginfo",
    6363                tr("Launch browser with Taginfo statistics for selected object"), null, false);
    6464        this.taginfoUrl = taginfoUrl.endsWith("/") ? taginfoUrl : taginfoUrl + '/';
  • trunk/src/org/openstreetmap/josm/tools/TaginfoRegionalInstance.java

    r15876 r16067  
    6262        return suffix;
    6363    }
     64
     65    @Override
     66    public String toString() {
     67        return (suffix == null ? "" : suffix + " ") + String.join("/", isoCodes);
     68    }
    6469}
Note: See TracChangeset for help on using the changeset viewer.