From baeb5f580faee6565ec4c497570c19300d109702 Mon Sep 17 00:00:00 2001 From: "Olga.shcherb" Date: Sat, 19 Jun 2010 12:49:27 +0000 Subject: [PATCH] added localization for amenity types git-svn-id: https://osmand.googlecode.com/svn/trunk@172 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/Messages.java | 15 ++++++ .../src/com/osmand/data/AmenityType.java | 46 +++++++++++-------- DataExtractionOSM/src/messages.properties | 36 +++++++++++++++ DataExtractionOSM/src/messages_ru.properties | 36 +++++++++++++++ 4 files changed, 114 insertions(+), 19 deletions(-) create mode 100644 DataExtractionOSM/src/com/osmand/Messages.java create mode 100644 DataExtractionOSM/src/messages.properties create mode 100644 DataExtractionOSM/src/messages_ru.properties diff --git a/DataExtractionOSM/src/com/osmand/Messages.java b/DataExtractionOSM/src/com/osmand/Messages.java new file mode 100644 index 0000000000..1cd6e3e580 --- /dev/null +++ b/DataExtractionOSM/src/com/osmand/Messages.java @@ -0,0 +1,15 @@ +package com.osmand; + +import java.util.ResourceBundle; + +public class Messages { + + + private static ResourceBundle bundle = ResourceBundle.getBundle("messages"); + + + public static String getMessage(String key){ + return bundle.getString(key); + } + +} diff --git a/DataExtractionOSM/src/com/osmand/data/AmenityType.java b/DataExtractionOSM/src/com/osmand/data/AmenityType.java index aa30421871..c6911c15e0 100644 --- a/DataExtractionOSM/src/com/osmand/data/AmenityType.java +++ b/DataExtractionOSM/src/com/osmand/data/AmenityType.java @@ -5,26 +5,33 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import com.osmand.Algoritms; +import com.osmand.Messages; // http://wiki.openstreetmap.org/wiki/Amenity // POI tags : amenity, leisure, shop, sport, tourism, historic; accessories (internet-access), natural ? public enum AmenityType { // Some of those types are subtypes of Amenity tag - SUSTENANCE, // restaurant, cafe ... - EDUCATION, // school, ... - TRANSPORTATION, // car_wash, parking, ... - FINANCE, // bank, atm, ... - HEALTHCARE, // hospital ... - ENTERTAINMENT, // cinema, ... (+! sauna, brothel) - TOURISM, // [TAG] hotel, sights, museum .. - HISTORIC, // [TAG] historic places, monuments (should we unify tourism/historic) - SHOP, // [TAG] convenience (product), clothes... - LEISURE, // [TAG] leisure - SPORT, // [TAG] sport - OTHER, // grave-yard, police, post-office [+Internet_access] + SUSTENANCE("amenity_type_sustenance"), // restaurant, cafe ... //$NON-NLS-1$ + EDUCATION("amenity_type_education"), // school, ... //$NON-NLS-1$ + TRANSPORTATION("amenity_type_transportation"), // car_wash, parking, ... //$NON-NLS-1$ + FINANCE("amenity_type_finance"), // bank, atm, ... //$NON-NLS-1$ + HEALTHCARE("amenity_type_healthcare"), // hospital ... + ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel) + TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum .. + HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic) + SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes... + LEISURE("amenity_type_leisure"), // [TAG] leisure + SPORT("amenity_type_sport"), // [TAG] sport + OTHER("amenity_type_other"), // grave-yard, police, post-office [+Internet_access] ; + private String name; + + private AmenityType(String name) + { + this.name = name; + } + public static AmenityType fromString(String s){ try { return AmenityType.valueOf(s.toUpperCase()); @@ -52,7 +59,8 @@ public enum AmenityType { } public static String toPublicString(AmenityType t){ - return Algoritms.capitalizeFirstLetterAndLowercase(t.toString().replace('_', ' ')); +// return Algoritms.capitalizeFirstLetterAndLowercase(t.toString().replace('_', ' ')); + return Messages.getMessage(t.name); } @@ -94,7 +102,7 @@ public enum AmenityType { amenityMap.put("beauty", AmenityType.SHOP); amenityMap.put("beverages", AmenityType.SHOP); amenityMap.put("bicycle", AmenityType.SHOP); - amenityMap.put("books", AmenityType.SHOP); + amenityMap.put("books", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("boutique", AmenityType.SHOP); amenityMap.put("butcher", AmenityType.SHOP); amenityMap.put("car", AmenityType.SHOP); @@ -120,10 +128,10 @@ public enum AmenityType { amenityMap.put("glaziery", AmenityType.SHOP); amenityMap.put("greengrocer", AmenityType.SHOP); amenityMap.put("hairdresser", AmenityType.SHOP); - amenityMap.put("hardware", AmenityType.SHOP); - amenityMap.put("hearing_aids", AmenityType.SHOP); - amenityMap.put("hifi", AmenityType.SHOP); - amenityMap.put("ice_cream", AmenityType.SHOP); + amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("hardware", AmenityType.SHOP); amenityMap.put("hearing_aids", AmenityType.SHOP); amenityMap.put("hifi", AmenityType.SHOP); diff --git a/DataExtractionOSM/src/messages.properties b/DataExtractionOSM/src/messages.properties new file mode 100644 index 0000000000..f028aa45af --- /dev/null +++ b/DataExtractionOSM/src/messages.properties @@ -0,0 +1,36 @@ + +amenity_type_education = Education + +amenity_type_entertainment = Entertainment + +amenity_type_finance = Finance + +amenity_type_healthcare = Healthcare + +amenity_type_historic = Historic + +amenity_type_leisure = Leisure + +amenity_type_other = Other + +amenity_type_shop = Shop + +amenity_type_sport = Sport + +amenity_type_sustenance = Sustenance + +amenity_type_tourism = Tourism + +amenity_type_transportation = Transportation + +poi_filter_car_aid = Car aid + +poi_filter_closest_poi = Closest poi + +poi_filter_custom_filter = Custom filter + +poi_filter_food_shop = Food shop + +poi_filter_for_tourists = For tourists + +poi_filter_fuel = Fuel diff --git a/DataExtractionOSM/src/messages_ru.properties b/DataExtractionOSM/src/messages_ru.properties new file mode 100644 index 0000000000..99620eb4ae --- /dev/null +++ b/DataExtractionOSM/src/messages_ru.properties @@ -0,0 +1,36 @@ + +amenity_type_education = \u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435 + +amenity_type_entertainment = \u0420\u0430\u0437\u0432\u043B\u0435\u0447\u0435\u043D\u0438\u044F + +amenity_type_finance = \u0424\u0438\u043D\u0430\u043D\u0441\u044B + +amenity_type_healthcare = \u0417\u0434\u043E\u0440\u043E\u0432\u044C\u0435 + +amenity_type_historic = \u0414\u043E\u0441\u0442\u043E\u043F\u0440\u0438\u043C\u0435\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 + +amenity_type_leisure = \u0414\u043E\u0441\u0443\u0433 + +amenity_type_other = \u0414\u0440\u0443\u0433\u043E\u0435 + +amenity_type_shop = \u041C\u0430\u0433\u0430\u0437\u0438\u043D\u044B + +amenity_type_sport = \u0421\u043F\u043E\u0440\u0442 + +amenity_type_sustenance = \u0415\u0434\u0430 + +amenity_type_tourism = \u0422\u0443\u0440\u0438\u0437\u043C + +amenity_type_transportation = \u0422\u0440\u0430\u043D\u0441\u043F\u043E\u0440\u0442 + +poi_filter_car_aid = \u0410\u0432\u0442\u043E\u043F\u043E\u043C\u043E\u0449\u044C + +poi_filter_closest_poi = \u0411\u043B\u0438\u0436\u0430\u0439\u0448\u0438\u0439 poi + +poi_filter_custom_filter = \u0414\u0440\u0443\u0433\u043E\u0439 \u0444\u0438\u043B\u044C\u0442\u0440 + +poi_filter_food_shop = \u041F\u0440\u043E\u0434\u0443\u043A\u0442\u043E\u0432\u044B\u0439 \u043C\u0430\u0433\u0430\u0437\u0438\u043D + +poi_filter_for_tourists = \u0414\u043B\u044F \u0442\u0443\u0440\u0438\u0441\u0442\u043E\u0432 + +poi_filter_fuel = \u0417\u0430\u043F\u0440\u0430\u0432\u043A\u0438