File indexing completed on 2024-05-12 04:42:10
0001 /* 0002 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "localization_p.h" 0008 #include "osmelementinformationmodel.h" 0009 0010 #include <KLazyLocalizedString> 0011 0012 namespace KOSMIndoorMap { 0013 0014 // diet types offered at restaurants 0015 struct { 0016 const char *keyName; 0017 const KLazyLocalizedString label; 0018 0019 constexpr inline OSMElementInformationModel::Key key() const { return OSMElementInformationModel::Diet; } 0020 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Main; } 0021 } static constexpr const diet_type_map[] = { 0022 { "diet:gluten_free", kli18nc("OSM::diet_type", "gluten free") }, 0023 { "diet:halal", kli18nc("OSM::diet_type", "halal") }, 0024 { "diet:kosher", kli18nc("OSM::diet_type", "kosher") }, 0025 { "diet:lactose_free", kli18nc("OSM::diet_type", "lactose free") }, 0026 { "diet:vegan", kli18nc("OSM::diet_type", "vegan") }, 0027 { "diet:vegetarian", kli18nc("OSM::diet_type", "vegetarian") }, 0028 }; 0029 static_assert(isSortedLookupTable(diet_type_map), "diet type map is not sorted!"); 0030 0031 // generic payment types (excluding cash, that's handled separately) 0032 struct { 0033 const char *keyName; 0034 OSMElementInformationModel::Key m_key; 0035 0036 constexpr inline OSMElementInformationModel::Key key() const { return m_key; } 0037 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Payment; } 0038 } static constexpr const payment_generic_type_map[] = { 0039 { "payment:account_cards", OSMElementInformationModel::PaymentDebitCard }, 0040 { "payment:credit_cards", OSMElementInformationModel::PaymentCreditCard }, 0041 { "payment:debit_cards", OSMElementInformationModel::PaymentDebitCard }, 0042 { "payment:electronic_purses", OSMElementInformationModel::PaymentStoredValueCard }, 0043 }; 0044 static_assert(isSortedLookupTable(payment_generic_type_map), "generic payment type map is not sorted!"); 0045 0046 // payment vendor types only, generic ones go into the list above and are handled separately 0047 struct { 0048 const char *keyName; 0049 OSMElementInformationModel::Key m_key; 0050 const KLazyLocalizedString label; 0051 0052 constexpr inline OSMElementInformationModel::Key key() const { return m_key; } 0053 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Payment; } 0054 } static constexpr const payment_type_map[] = { 0055 { "payment:american_express", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "American Express") }, 0056 { "payment:apple_pay", OSMElementInformationModel::PaymentDigital, kli18nc("OSM::payment_method", "Apple Pay") }, 0057 { "payment:diners_club", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "Diners Club") }, 0058 { "payment:discover_card", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "Discover Card") }, 0059 { "payment:jcb", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "JCB") }, 0060 { "payment:girocard", OSMElementInformationModel::PaymentDebitCard, kli18nc("OSM::payment_method", "Girocard") }, 0061 { "payment:google_pay", OSMElementInformationModel::PaymentDigital, kli18nc("OSM::payment_method", "Google Pay") }, 0062 { "payment:maestro", OSMElementInformationModel::PaymentDebitCard, kli18nc("OSM::payment_method", "Maestro") }, 0063 { "payment:mastercard", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "Mastercard") }, 0064 { "payment:unionpay", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "UnionPay") }, 0065 { "payment:v_pay", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "V Pay") }, 0066 { "payment:vpay", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "V Pay") }, 0067 { "payment:visa", OSMElementInformationModel::PaymentCreditCard, kli18nc("OSM::payment_method", "Visa") }, 0068 }; 0069 0070 static constexpr const ValueMapEntry wheelchair_map[] = { 0071 { "limited", kli18nc("OSM::wheelchair_access", "limited") }, 0072 { "no", kli18nc("OSM::wheelchair_access", "no") }, 0073 { "yes", kli18nc("OSM::wheelchair_access", "yes") }, 0074 }; 0075 static_assert(isSortedLookupTable(wheelchair_map), "wheelchair access map is not sorted!"); 0076 0077 // socket types for charging stations 0078 struct { 0079 const char *keyName; 0080 const KLazyLocalizedString label; 0081 0082 constexpr inline OSMElementInformationModel::Key key() const { return OSMElementInformationModel::Socket; } 0083 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Main; } 0084 } static constexpr const socket_type_map[] = { 0085 { "socket:chademo", kli18nc("OSM::charging_station_socket", "Chademo") }, 0086 { "socket:schuko", kli18nc("OSM::charging_station_socket", "Schuko") }, 0087 { "socket:tesla_standard", kli18nc("OSM::charging_station_socket", "Tesla") }, 0088 { "socket:tesla_supercharger", kli18nc("OSM::charging_station_socket", "Tesla Supercharger") }, 0089 { "socket:tesla_supercharger_ccs", kli18nc("OSM::charging_station_socket", "Tesla Supercharger CCS") }, 0090 { "socket:type2", kli18nc("OSM::charging_station_socket", "Type 2") }, 0091 { "socket:type2_cable", kli18nc("OSM::charging_station_socket", "Type 2 cable") }, 0092 { "socket:type2_combo", kli18nc("OSM::charging_station_socket", "Type 2 CCS") }, 0093 { "socket:typee", kli18nc("OSM::charging_station_socket", "Type E") }, 0094 }; 0095 static_assert(isSortedLookupTable(socket_type_map), "socket type map is not sorted!"); 0096 0097 // charging station authentication methods 0098 struct { 0099 const char *keyName; 0100 const KLazyLocalizedString label; 0101 0102 constexpr inline OSMElementInformationModel::Key key() const { return OSMElementInformationModel::Authentication; } 0103 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Main; } 0104 } static constexpr const authentication_type_map[] = { 0105 { "authentication:app", kli18nc("OSM::charging_station_authentication", "app") }, 0106 { "authentication:membership_card", kli18nc("OSM::charging_station_authentication", "membership card") }, 0107 { "authentication:nfc", kli18nc("OSM::charging_station_authentication", "NFC") }, 0108 { "authentication:none", kli18nc("OSM::charging_station_authentication", "none") }, 0109 { "authentication:phone_call", kli18nc("OSM::charging_station_authentication", "phone call") }, 0110 { "authentication:short_message", kli18nc("OSM::charging_station_authentication", "SMS") }, 0111 }; 0112 static_assert(isSortedLookupTable(authentication_type_map), "authentication type map is not sorted!"); 0113 0114 // bicycle parking values 0115 // see https://taginfo.openstreetmap.org/keys/?key=bicycle_parking#values 0116 static constexpr const ValueMapEntry bicycle_parking_map[] = { 0117 { "anchors", kli18nc("OSM::bicycle_parking", "anchors") }, 0118 { "bollard", kli18nc("OSM::bicycle_parking", "bollard") }, 0119 { "building", kli18nc("OSM::bicycle_parking", "building") }, 0120 { "ground_slots", kli18nc("OSM::bicycle_parking", "ground slots") }, 0121 { "lockers", kli18nc("OSM::bicycle_parking", "lockers") }, 0122 { "racks", kli18nc("OSM::bicycle_parking", "racks") }, 0123 { "shed", kli18nc("OSM::bicycle_parking", "shed") }, 0124 { "stands", kli18nc("OSM::bicycle_parking", "stands") }, 0125 { "wall_loops", kli18nc("OSM::bicycle_parking", "wall loops") }, 0126 { "wide_stands", kli18nc("OSM::bicycle_parking", "wide stands") }, 0127 }; 0128 static_assert(isSortedLookupTable(bicycle_parking_map), "bicycle parking map is not sorted!"); 0129 0130 // shared vehicle types 0131 // tag keys are our extension, based on KPublicTransport data 0132 static constexpr const ValueMapEntry available_vehicles_map[] = { 0133 { "mx:realtime_available:bike", kli18ncp("available rental vehicles", "%1 bike", "%1 bikes") }, 0134 { "mx:realtime_available:pedelec", kli18ncp("available rental vehicles", "%1 pedelec", "%1 pedelecs") }, 0135 { "mx:realtime_available:scooter", kli18ncp("available rental vehicles", "%1 kick scooter", "%1 kick scooters") }, 0136 { "mx:realtime_available:motorcycle", kli18ncp("available rental vehicles", "%1 moped", "%1 mopeds") }, 0137 { "mx:realtime_available:car", kli18ncp("available rental vehicles", "%1 car", "%1 cars") }, 0138 }; 0139 0140 // gender neutral/gender segregated facilities 0141 struct { 0142 const char *keyName; 0143 const KLazyLocalizedString label; 0144 0145 constexpr inline OSMElementInformationModel::Key key() const { return OSMElementInformationModel::Gender; } 0146 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::UnresolvedCategory; } 0147 } static constexpr const gender_type_map[] = { 0148 { "female", kli18nc("OSM::gender_segregation", "female") }, 0149 { "male", kli18nc("OSM::gender_segregation", "male") }, 0150 { "unisex", kli18nc("OSM::gender_segregation", "unisex") }, 0151 }; 0152 static_assert(isSortedLookupTable(gender_type_map), "gender type map is not sorted!"); 0153 0154 // tactile writing variants 0155 struct { 0156 const char *keyName; 0157 const KLazyLocalizedString label; 0158 0159 constexpr inline OSMElementInformationModel::Key key() const { return OSMElementInformationModel::TactileWriting; } 0160 constexpr inline OSMElementInformationModel::KeyCategory category() const { return OSMElementInformationModel::Accessibility; } 0161 } static constexpr const tactile_writing_map[] = { 0162 { "tactile_writing:braille", kli18nc("tactile writing", "braille") }, 0163 { "tactile_writing:embossed_printed_letters", kli18nc("tactile writing", "embossed printed letters") }, 0164 { "tactile_writing:engraved_printed_letters", kli18nc("tactile writing", "engraved printed letters") }, 0165 }; 0166 static_assert(isSortedLookupTable(tactile_writing_map), "tactile writing type map is not sorted!"); 0167 0168 }