aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-06-29 19:37:05 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-06-29 19:37:05 +0200
commita02fe9aa44d97b6230a50678ab8d8536e03264e5 (patch)
tree9b1f83659f5501f0ded33d4d246880d1d8d2c76b
parentcd6e3152799926baafc59b154d21d9a8f3dcb48b (diff)
downloadcgeo-a02fe9aa44d97b6230a50678ab8d8536e03264e5.zip
cgeo-a02fe9aa44d97b6230a50678ab8d8536e03264e5.tar.gz
cgeo-a02fe9aa44d97b6230a50678ab8d8536e03264e5.tar.bz2
#1833: recognize localized waypoint type names
* we may want to fix the export of those nonetheless
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java12
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java2
2 files changed, 12 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index fbe1b65..f8ec61c 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -790,9 +790,17 @@ public abstract class GPXParser extends FileParser {
return WaypointType.TRAILHEAD;
} else if ("final location".equalsIgnoreCase(sym)) {
return WaypointType.FINAL;
- } else {
- return WaypointType.WAYPOINT;
}
+ // this is not fully correct, but lets also look for localized waypoint types
+ for (WaypointType waypointType : WaypointType.ALL_TYPES_EXCEPT_OWN) {
+ final String localized = waypointType.getL10n();
+ if (StringUtils.isNotEmpty(localized)) {
+ if (localized.equalsIgnoreCase(sym)) {
+ return waypointType;
+ }
+ }
+ }
+ return WaypointType.WAYPOINT;
}
private void findGeoCode(final String input) {
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 8193fd8..5ba4081 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -107,6 +107,8 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertEquals(WaypointType.TRAILHEAD, GPXParser.convertWaypointSym2Type("Trailhead"));
assertEquals(WaypointType.FINAL, GPXParser.convertWaypointSym2Type("Final location"));
assertEquals(WaypointType.WAYPOINT, GPXParser.convertWaypointSym2Type("Reference point"));
+
+ assertEquals(WaypointType.PARKING, GPXParser.convertWaypointSym2Type(WaypointType.PARKING.getL10n()));
}
private static void assertGc31j2h(final cgCache cache) {