added localization for amenity types

git-svn-id: https://osmand.googlecode.com/svn/trunk@172 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Olga.shcherb 2010-06-19 12:49:27 +00:00
parent 529fe52976
commit baeb5f580f
4 changed files with 114 additions and 19 deletions

View file

@ -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);
}
}

View file

@ -5,26 +5,33 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.osmand.Algoritms; import com.osmand.Messages;
// http://wiki.openstreetmap.org/wiki/Amenity // http://wiki.openstreetmap.org/wiki/Amenity
// POI tags : amenity, leisure, shop, sport, tourism, historic; accessories (internet-access), natural ? // POI tags : amenity, leisure, shop, sport, tourism, historic; accessories (internet-access), natural ?
public enum AmenityType { public enum AmenityType {
// Some of those types are subtypes of Amenity tag // Some of those types are subtypes of Amenity tag
SUSTENANCE, // restaurant, cafe ... SUSTENANCE("amenity_type_sustenance"), // restaurant, cafe ... //$NON-NLS-1$
EDUCATION, // school, ... EDUCATION("amenity_type_education"), // school, ... //$NON-NLS-1$
TRANSPORTATION, // car_wash, parking, ... TRANSPORTATION("amenity_type_transportation"), // car_wash, parking, ... //$NON-NLS-1$
FINANCE, // bank, atm, ... FINANCE("amenity_type_finance"), // bank, atm, ... //$NON-NLS-1$
HEALTHCARE, // hospital ... HEALTHCARE("amenity_type_healthcare"), // hospital ...
ENTERTAINMENT, // cinema, ... (+! sauna, brothel) ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel)
TOURISM, // [TAG] hotel, sights, museum .. TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum ..
HISTORIC, // [TAG] historic places, monuments (should we unify tourism/historic) HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic)
SHOP, // [TAG] convenience (product), clothes... SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes...
LEISURE, // [TAG] leisure LEISURE("amenity_type_leisure"), // [TAG] leisure
SPORT, // [TAG] sport SPORT("amenity_type_sport"), // [TAG] sport
OTHER, // grave-yard, police, post-office [+Internet_access] 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){ public static AmenityType fromString(String s){
try { try {
return AmenityType.valueOf(s.toUpperCase()); return AmenityType.valueOf(s.toUpperCase());
@ -52,7 +59,8 @@ public enum AmenityType {
} }
public static String toPublicString(AmenityType t){ 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("beauty", AmenityType.SHOP);
amenityMap.put("beverages", AmenityType.SHOP); amenityMap.put("beverages", AmenityType.SHOP);
amenityMap.put("bicycle", 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("boutique", AmenityType.SHOP);
amenityMap.put("butcher", AmenityType.SHOP); amenityMap.put("butcher", AmenityType.SHOP);
amenityMap.put("car", AmenityType.SHOP); amenityMap.put("car", AmenityType.SHOP);
@ -120,10 +128,10 @@ public enum AmenityType {
amenityMap.put("glaziery", AmenityType.SHOP); amenityMap.put("glaziery", AmenityType.SHOP);
amenityMap.put("greengrocer", AmenityType.SHOP); amenityMap.put("greengrocer", AmenityType.SHOP);
amenityMap.put("hairdresser", AmenityType.SHOP); amenityMap.put("hairdresser", AmenityType.SHOP);
amenityMap.put("hardware", AmenityType.SHOP); amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$
amenityMap.put("hearing_aids", AmenityType.SHOP); amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$
amenityMap.put("hifi", AmenityType.SHOP); amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$
amenityMap.put("ice_cream", AmenityType.SHOP); amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$
amenityMap.put("hardware", AmenityType.SHOP); amenityMap.put("hardware", AmenityType.SHOP);
amenityMap.put("hearing_aids", AmenityType.SHOP); amenityMap.put("hearing_aids", AmenityType.SHOP);
amenityMap.put("hifi", AmenityType.SHOP); amenityMap.put("hifi", AmenityType.SHOP);

View file

@ -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

View file

@ -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