- Timestamp:
- 2020-01-14T21:55:56+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r15661 r15711 2 2 package org.openstreetmap.josm.tools; 3 3 4 import java.util. LinkedList;4 import java.util.ArrayList; 5 5 import java.util.List; 6 6 import java.util.Locale; … … 288 288 */ 289 289 public static List<String> getLanguageCodes(Locale l) { 290 List<String> list = new LinkedList<>();290 List<String> list = new ArrayList<>(4); 291 291 if (l == null) 292 292 l = Locale.getDefault(); -
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r15706 r15711 12 12 import java.util.regex.Matcher; 13 13 import java.util.regex.Pattern; 14 import java.util.stream.Collectors; 14 15 import java.util.stream.Stream; 15 16 … … 42 43 * Maps OSM keys to formatter URLs from Wikidata and OSM Sophox where {@code "$1"} has to be replaced by a value. 43 44 */ 44 static MultiMap<String, String> wikidataRules = new MultiMap<>(); 45 static final MultiMap<String, String> wikidataRules = new MultiMap<>(); 46 47 static final String languagePattern = LanguageInfo.getLanguageCodes(null).stream() 48 .map(Pattern::quote) 49 .collect(Collectors.joining("|")); 45 50 46 51 private Tag2Link() { … … 127 132 128 133 // Search 129 if (key.matches("^(.+[:_])?name([:_] .+)?$")) {134 if (key.matches("^(.+[:_])?name([:_]" + languagePattern + ")?$")) { 130 135 linkConsumer.acceptLink(tr("Search on DuckDuckGo"), "https://duckduckgo.com/?q=" + value); 131 136 }
Note:
See TracChangeset
for help on using the changeset viewer.