From d4cedeed8b57d4f5983ad7c8af8a7070f18a2a6e Mon Sep 17 00:00:00 2001 From: Yannik Bloscheck Date: Thu, 15 Jan 2026 18:13:04 +0100 Subject: [PATCH] Use actual native languages for world map Signed-off-by: Yannik Bloscheck --- .../sdk/src/main/assets/countries_meta.txt | 1 + data/countries_meta.txt | 4 +- iphone/Maps/Core/Settings/MWMSettings.h | 3 + iphone/Maps/Core/Settings/MWMSettings.mm | 14 +++++ .../de.lproj/Localizable.strings | 1 + .../en-GB.lproj/Localizable.strings | 1 + .../en.lproj/Localizable.strings | 1 + iphone/Maps/Maps.xcodeproj/project.pbxproj | 4 ++ iphone/Maps/Model/Settings.swift | 11 ++++ iphone/Maps/UI/Settings/SettingsView.swift | 22 ++++++++ libs/indexer/feature.cpp | 12 +++- libs/indexer/feature_meta.cpp | 5 ++ libs/indexer/feature_meta.hpp | 1 + libs/indexer/feature_region_locator.cpp | 26 +++++++++ libs/indexer/feature_region_locator.hpp | 56 +++++++++++++++++++ libs/indexer/feature_utils.cpp | 43 +++++++++----- libs/indexer/feature_utils.hpp | 2 +- libs/indexer/mwm_set.hpp | 4 +- libs/kml/type_utils.cpp | 4 +- libs/platform/settings.cpp | 1 + libs/platform/settings.hpp | 1 + qt/CMakeLists.txt | 1 + .../indexer/indexer.xcodeproj/project.pbxproj | 10 +++- 23 files changed, 206 insertions(+), 22 deletions(-) create mode 120000 android/sdk/src/main/assets/countries_meta.txt create mode 100644 libs/indexer/feature_region_locator.cpp create mode 100644 libs/indexer/feature_region_locator.hpp diff --git a/android/sdk/src/main/assets/countries_meta.txt b/android/sdk/src/main/assets/countries_meta.txt new file mode 120000 index 000000000..a0467ee02 --- /dev/null +++ b/android/sdk/src/main/assets/countries_meta.txt @@ -0,0 +1 @@ +../../../../../data/countries_meta.txt \ No newline at end of file diff --git a/data/countries_meta.txt b/data/countries_meta.txt index 636e44506..48e078f5e 100644 --- a/data/countries_meta.txt +++ b/data/countries_meta.txt @@ -1,9 +1,9 @@ { "World": { - "languages": ["int_name", "en", "default"] + "languages": [] }, "WorldCoasts": { - "languages": ["int_name", "en", "default"] + "languages": [] }, "Abkhazia": { "languages": ["ab", "ru"] diff --git a/iphone/Maps/Core/Settings/MWMSettings.h b/iphone/Maps/Core/Settings/MWMSettings.h index 85dafa2b8..348b42b0e 100644 --- a/iphone/Maps/Core/Settings/MWMSettings.h +++ b/iphone/Maps/Core/Settings/MWMSettings.h @@ -41,6 +41,9 @@ NS_SWIFT_NAME(SettingsBridge) + (NSString *)mapLanguageCode; + (void)setMapLanguageCode:(NSString *)mapLanguageCode; ++ (BOOL)mapLanguageLimitAlternativesToLocal; ++ (void)setMapLanguageLimitAlternativesToLocal:(BOOL)mapLanguageLimitAlternativesToLocal; + + (BOOL)transliteration; + (void)setTransliteration:(BOOL)transliteration; diff --git a/iphone/Maps/Core/Settings/MWMSettings.mm b/iphone/Maps/Core/Settings/MWMSettings.mm index b87542b84..01a34bd26 100644 --- a/iphone/Maps/Core/Settings/MWMSettings.mm +++ b/iphone/Maps/Core/Settings/MWMSettings.mm @@ -234,6 +234,20 @@ NSString * const kUDFileLoggingEnabledKey = @"FileLoggingEnabledKey"; } } ++ (BOOL)mapLanguageLimitAlternativesToLocal +{ + bool enabled = true; + UNUSED_VALUE(settings::Get(settings::kMapLanguageLimitAlternativesToLocal, enabled)); + return enabled; +} + ++ (void)setMapLanguageLimitAlternativesToLocal:(BOOL)mapLanguageLimitAlternativesToLocal +{ + settings::Set(settings::kMapLanguageLimitAlternativesToLocal, static_cast(mapLanguageLimitAlternativesToLocal)); + auto & f = GetFramework(); + f.InvalidateRect(f.GetCurrentViewport()); +} + + (BOOL)transliteration { return GetFramework().LoadTransliteration(); } + (void)setTransliteration:(BOOL)transliteration { diff --git a/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings index 4ec7931a5..9f5654a9c 100644 --- a/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings +++ b/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings @@ -1095,6 +1095,7 @@ "edit_track" = "Track bearbeiten"; "pref_mapappearance_title" = "Kartendarstellung"; "pref_maplanguage_title" = "Karten-Sprache"; +"limit_map_language_alternatives_to_local" = "Nutzung alternativer Sprachen auf lokale Sprachen begrenzen"; "transliteration_title_disabled_summary" = "Bei der Nutzung der lokalen Sprache für die Karte ausgeschaltet"; "pref_maplanguage_local" = "Lokale Sprache"; "existence_confirmed_time_ago" = "Existenz bestätigt %@"; diff --git a/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings index f632cb850..837b96641 100644 --- a/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings +++ b/iphone/Maps/LocalizedStrings/en-GB.lproj/Localizable.strings @@ -766,6 +766,7 @@ "traffic_data_unavailable" = "Traffic data is not available"; "enable_logging" = "Enable logging"; "log_file_size" = "Log file size: %@"; +"limit_map_language_alternatives_to_local" = "Limit use of alternative languages to local ones"; "transliteration_title" = "Transliterate into Latin alphabet"; "transliteration_title_disabled_summary" = "Disabled when always using the local language for the map"; diff --git a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings index b916439c4..8a9bdbb57 100644 --- a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings +++ b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings @@ -786,6 +786,7 @@ "traffic_data_unavailable" = "Traffic data is not available"; "enable_logging" = "Enable logging"; "log_file_size" = "Log file size: %@"; +"limit_map_language_alternatives_to_local" = "Limit use of alternative languages to local ones"; "transliteration_title" = "Transliterate into Latin alphabet"; "transliteration_title_disabled_summary" = "Disabled when always using the local language for the map"; diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 04cd96cd6..0bb64f5e1 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 165953942CB44B5600CFED7C /* symbols in Resources */ = {isa = PBXBuildFile; fileRef = 165953932CB44B3B00CFED7C /* symbols */; }; 1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */; }; 270C9C282E16AB6F00ABA688 /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 270C9C252E16AB6300ABA688 /* Profile.swift */; }; + 271186872F19467400FD7FF3 /* countries_meta.txt in Resources */ = {isa = PBXBuildFile; fileRef = 271186862F19467400FD7FF3 /* countries_meta.txt */; }; 27176A862E65B0150015F25F /* Icon.icon in Resources */ = {isa = PBXBuildFile; fileRef = 27176A852E65B0150015F25F /* Icon.icon */; }; 27176A8A2E65B01B0015F25F /* Debug Icon.icon in Resources */ = {isa = PBXBuildFile; fileRef = 27176A892E65B01B0015F25F /* Debug Icon.icon */; }; 272CA4492F127221005A3F5B /* subtypes.csv in Resources */ = {isa = PBXBuildFile; fileRef = 272CA4482F127221005A3F5B /* subtypes.csv */; }; @@ -763,6 +764,7 @@ 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = "UIColor+PartnerColor.m"; sourceTree = ""; tabWidth = 2; }; 1DFA2F6E20D3CA9200FB2C66 /* UIColorRoutines.h */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = UIColorRoutines.h; sourceTree = ""; tabWidth = 2; }; 270C9C252E16AB6300ABA688 /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = ""; }; + 271186862F19467400FD7FF3 /* countries_meta.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = countries_meta.txt; path = ../../data/countries_meta.txt; sourceTree = SOURCE_ROOT; }; 27176A852E65B0150015F25F /* Icon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = Icon.icon; sourceTree = ""; }; 27176A892E65B01B0015F25F /* Debug Icon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = "Debug Icon.icon"; sourceTree = ""; }; 272CA4482F127221005A3F5B /* subtypes.csv */ = {isa = PBXFileReference; lastKnownFileType = text; name = subtypes.csv; path = ../../data/subtypes.csv; sourceTree = SOURCE_ROOT; }; @@ -3941,6 +3943,7 @@ 452FCA3A1B6A3DF7007019AB /* colors.txt */, 97A5967E19B9CD47007A963F /* copyright.html */, FA46DA2B12D4166E00968C36 /* countries.txt */, + 271186862F19467400FD7FF3 /* countries_meta.txt */, 4A23D1561B8B4DD700D4EB6F /* drules_proto_default_light.bin */, 4A00DBDE1AB704C400113624 /* drules_proto_default_dark.bin */, FA637ECC29A500BE00D8921A /* drules_proto_outdoors_light.bin */, @@ -4179,6 +4182,7 @@ files = ( 165953742CB1D85500CFED7C /* fonts in Resources */, 165953942CB44B5600CFED7C /* symbols in Resources */, + 271186872F19467400FD7FF3 /* countries_meta.txt in Resources */, 47AEF8402231249E00D20538 /* categories_brands.txt in Resources */, F6C3A1B221AC22810060EEC8 /* Alert 5.m4a in Resources */, 3404F49A2028A20D0090E401 /* BMCCategoryCell.xib in Resources */, diff --git a/iphone/Maps/Model/Settings.swift b/iphone/Maps/Model/Settings.swift index c5de941ac..3b8295960 100644 --- a/iphone/Maps/Model/Settings.swift +++ b/iphone/Maps/Model/Settings.swift @@ -167,6 +167,17 @@ import AVFoundation } + /// If the alternative languages for the app only should be used when they are the local native language + static var shouldLimitMapLanguageAlternativesToLocal: Bool { + get { + return SettingsBridge.mapLanguageLimitAlternativesToLocal() + } + set { + SettingsBridge.setMapLanguageLimitAlternativesToLocal(newValue) + } + } + + /// If the compass should be calibrated @objc static var shouldCalibrateCompass: Bool { get { diff --git a/iphone/Maps/UI/Settings/SettingsView.swift b/iphone/Maps/UI/Settings/SettingsView.swift index c2f1e65d8..97acf9b40 100644 --- a/iphone/Maps/UI/Settings/SettingsView.swift +++ b/iphone/Maps/UI/Settings/SettingsView.swift @@ -36,6 +36,10 @@ struct SettingsView: View { @State var selectedLanguageForMap: Settings.MapLanguage.ID? = nil + /// If the alternative languages for the app only should be used when they are the local native language + @State private var shouldLimitMapLanguageAlternativesToLocal: Bool = true + + /// If names should be transliterated to Latin @State private var shouldTransliterateToLatin: Bool = true @@ -153,6 +157,20 @@ struct SettingsView: View { Text("pref_maplanguage_title") } + Toggle(isOn: $shouldLimitMapLanguageAlternativesToLocal) { + VStack(alignment: .leading) { + Text("limit_map_language_alternatives_to_local") + + if selectedLanguageForMap == "default" { + Text("transliteration_title_disabled_summary") + .font(.footnote) + .foregroundStyle(.secondary) + } + } + } + .tint(.accent) + .disabled(selectedLanguageForMap == "default") + Toggle(isOn: $shouldTransliterateToLatin) { VStack(alignment: .leading) { Text("transliteration_title") @@ -296,6 +314,7 @@ struct SettingsView: View { hasAutomaticDownload = Settings.hasAutomaticDownload hasIncreasedFontsize = Settings.hasIncreasedFontsize selectedLanguageForMap = Settings.languageForMap + shouldLimitMapLanguageAlternativesToLocal = Settings.shouldLimitMapLanguageAlternativesToLocal shouldTransliterateToLatin = Settings.shouldTransliterateToLatin selectedMapAppearance = Settings.mapAppearance selectedAppearance = Settings.appearance @@ -328,6 +347,9 @@ struct SettingsView: View { Settings.languageForMap = changedSelectedLanguageForMap } } + .onChange(of: shouldLimitMapLanguageAlternativesToLocal) { changedShouldLimitMapLanguageAlternativesToLocal in + Settings.shouldLimitMapLanguageAlternativesToLocal = changedShouldLimitMapLanguageAlternativesToLocal + } .onChange(of: shouldTransliterateToLatin) { changedShouldTransliterateToLatin in Settings.shouldTransliterateToLatin = changedShouldTransliterateToLatin } diff --git a/libs/indexer/feature.cpp b/libs/indexer/feature.cpp index 610b76f2e..fc0ca5451 100644 --- a/libs/indexer/feature.cpp +++ b/libs/indexer/feature.cpp @@ -3,6 +3,7 @@ #include "indexer/classificator.hpp" #include "indexer/feature_algo.hpp" #include "indexer/feature_impl.hpp" +#include "indexer/feature_region_locator.hpp" #include "indexer/feature_utils.hpp" #include "indexer/map_object.hpp" #include "indexer/shared_load_info.hpp" @@ -825,7 +826,16 @@ void FeatureType::GetReadableName(bool allowTranslit, int8_t deviceLang, feature ParseCommon(); - feature::GetReadableName({GetNames(), mwmInfo->GetRegionData(), deviceLang, allowTranslit}, out); + auto regionData = mwmInfo->GetRegionData(); + if (regionData.IsWorldLevel()) + { + if (GetGeomType() == feature::GeomType::Point) + regionData.SetLanguages(RegionLocator::Instance().GetLocalLanguages(GetCenter())); + else + regionData.SetLanguages({"int_name", "en", "default"}); + } + + feature::GetReadableName({GetNames(), regionData, deviceLang, allowTranslit}, out); } string const & FeatureType::GetHouseNumber() diff --git a/libs/indexer/feature_meta.cpp b/libs/indexer/feature_meta.cpp index 2e58c23f7..ad40c6e57 100644 --- a/libs/indexer/feature_meta.cpp +++ b/libs/indexer/feature_meta.cpp @@ -216,6 +216,11 @@ void Metadata::ClearPOIAttribs() ++i; } +bool RegionData::IsWorldLevel() const +{ + return Get(RegionData::Type::RD_LANGUAGES).empty(); +} + void RegionData::SetLanguages(vector const & codes) { string value; diff --git a/libs/indexer/feature_meta.hpp b/libs/indexer/feature_meta.hpp index 6e06fa58d..a27dd1e2d 100644 --- a/libs/indexer/feature_meta.hpp +++ b/libs/indexer/feature_meta.hpp @@ -224,6 +224,7 @@ public: MetadataBase::Set(type, s); } + bool IsWorldLevel() const; void SetLanguages(std::vector const & codes); void GetLanguages(std::vector & langs) const; bool HasLanguage(int8_t const lang) const; diff --git a/libs/indexer/feature_region_locator.cpp b/libs/indexer/feature_region_locator.cpp new file mode 100644 index 000000000..20766f630 --- /dev/null +++ b/libs/indexer/feature_region_locator.cpp @@ -0,0 +1,26 @@ +#include "indexer/feature_region_locator.hpp" + +#include "defines.hpp" +#include "platform/platform.hpp" + +namespace feature +{ +/// Constructor +RegionLocator::RegionLocator() +{ + auto & platform = GetPlatform(); + m_infoGetter = storage::CountryInfoReader::CreateCountryInfoGetter(platform); + + auto reader = platform.GetReader(COUNTRIES_META_FILE); + string buffer; + reader->ReadAsString(buffer); + m_jsonRoot = base::Json(buffer.data()); +} + +/// Static instance +RegionLocator const & RegionLocator::Instance() +{ + static RegionLocator instance; + return instance; +} +} // namespace feature diff --git a/libs/indexer/feature_region_locator.hpp b/libs/indexer/feature_region_locator.hpp new file mode 100644 index 000000000..4f0b1c11a --- /dev/null +++ b/libs/indexer/feature_region_locator.hpp @@ -0,0 +1,56 @@ +#pragma once + +#include "coding/reader.hpp" +#include "cppjansson/cppjansson.hpp" +#include "storage/storage.hpp" +#include "storage/country_info_getter.hpp" + +#include + +namespace feature +{ + using namespace std; + + class RegionLocator + { + public: + /// Static instance + static RegionLocator const & Instance(); + + /** + * Find the local languages codes for a given point + * @param point The point to check + * @return The local language codes + */ + vector GetLocalLanguages(m2::PointD const point) const + { + auto const regionId = m_infoGetter->GetRegionCountryId(point); + + vector regionIdParts; + for (auto const regionIdPart : strings::Tokenize(regionId, "_")) { + regionIdParts.push_back(string(regionIdPart)); + } + + json_t const * jsonData = nullptr; + vector languages; + while (languages.empty() && !regionIdParts.empty()) { + string regionId = strings::JoinStrings(regionIdParts, "_"); + FromJSONObjectOptionalField(m_jsonRoot.get(), regionId, jsonData); + if (jsonData) + FromJSONObjectOptionalField(jsonData, "languages", languages); + regionIdParts.pop_back(); + } + return languages; + } + + private: + /// Constructor + RegionLocator(); + + /// Country info getter + unique_ptr m_infoGetter; + + /// JSON root + base::Json m_jsonRoot; + }; +} // namespace feature diff --git a/libs/indexer/feature_utils.cpp b/libs/indexer/feature_utils.cpp index 8d2c28447..aeb0e5e02 100644 --- a/libs/indexer/feature_utils.cpp +++ b/libs/indexer/feature_utils.cpp @@ -9,6 +9,7 @@ #include "platform/distance.hpp" #include "platform/localization.hpp" #include "platform/preferred_languages.hpp" +#include "platform/settings.hpp" #include "coding/string_utf8_multilang.hpp" #include "coding/transliteration.hpp" @@ -117,7 +118,7 @@ bool IsNativeLang(feature::RegionData const & regionData, int8_t deviceLang) return false; } -int8_t DefaultLanguage(feature::RegionData const & regionData, vector const & langs) +int8_t DefaultLanguageFromRegionData(feature::RegionData const & regionData, vector const & langs) { for (auto const lang : langs) { @@ -132,18 +133,39 @@ int8_t DefaultLanguage(feature::RegionData const & regionData, vector co return StrUtf8::kDefaultCode; } -vector PrioritizedLanguages(vector const & langs, int8_t defaultLang) +vector PrioritizedLanguages(optional const & regionData = {}) { + bool limitAlternativesToLocal = true; + UNUSED_VALUE(settings::Get(settings::kMapLanguageLimitAlternativesToLocal, limitAlternativesToLocal)); + vector prioritizedLangs = {}; + vector const langs = languages::GetPreferredLangIndexes(); + + int8_t defaultLang = StrUtf8::kUnsupportedLanguageCode; + if (regionData.has_value()) + defaultLang = DefaultLanguageFromRegionData(regionData.value(), langs); + for (auto const lang : langs) { - if (find(prioritizedLangs.begin(), prioritizedLangs.end(), lang) == prioritizedLangs.end()) + if (!limitAlternativesToLocal && + find(prioritizedLangs.begin(), prioritizedLangs.end(), lang) == prioritizedLangs.end()) prioritizedLangs.push_back(lang); if (defaultLang != StrUtf8::kUnsupportedLanguageCode && defaultLang == lang) prioritizedLangs.push_back(StrUtf8::kDefaultCode); + if (!limitAlternativesToLocal) + { + auto const similarLangs = GetSimilarLanguages(lang); + prioritizedLangs.insert(prioritizedLangs.cend(), similarLangs.cbegin(), similarLangs.cend()); + } + } + + if (limitAlternativesToLocal) + { + auto lang = langs.front(); + prioritizedLangs.push_back(lang); auto const similarLangs = GetSimilarLanguages(lang); prioritizedLangs.insert(prioritizedLangs.cend(), similarLangs.cbegin(), similarLangs.cend()); } @@ -157,8 +179,7 @@ vector PrioritizedLanguages(vector const & langs, int8_t default void GetReadableNameImpl(NameParamsIn const & in, bool preferDefault, NameParamsOut & out) { - auto const preferredLangs = languages::GetPreferredLangIndexes(); - auto const langPriority = PrioritizedLanguages(preferredLangs, DefaultLanguage(in.regionData, preferredLangs)); + auto const langPriority = PrioritizedLanguages(in.regionData); if (GetBestName(in.src, langPriority, out.primary)) return; @@ -361,8 +382,7 @@ void GetPreferredNames(NameParamsIn const & in, NameParamsOut & out) if (in.IsNativeOrSimilarLang()) return GetReadableNameImpl(in, true /* preferDefault */, out); - auto const preferredLangs = languages::GetPreferredLangIndexes(); - auto const primaryCodes = PrioritizedLanguages(preferredLangs, DefaultLanguage(in.regionData, preferredLangs)); + auto const primaryCodes = PrioritizedLanguages(in.regionData); if (!GetBestName(in.src, primaryCodes, out.primary) && in.allowTranslit) GetTransliteratedName(in.regionData, in.src, out.transliterated); @@ -427,17 +447,14 @@ int8_t GetNameForSearchOnBooking(RegionData const & regionData, StringUtf8Multil } */ -bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, string_view & out) +bool GetPreferredName(StringUtf8Multilang const & src, string_view & out) { - auto const preferredLangs = languages::GetPreferredLangIndexes(); - auto const priorityList = PrioritizedLanguages(preferredLangs, StrUtf8::kUnsupportedLanguageCode); - return GetBestName(src, priorityList, out); + return GetBestName(src, PrioritizedLanguages(), out); } vector GetDescriptionLangPriority(RegionData const & regionData) { - auto const preferredLangs = languages::GetPreferredLangIndexes(); - return PrioritizedLanguages(preferredLangs, DefaultLanguage(regionData, preferredLangs)); + return PrioritizedLanguages(regionData); } vector GetCuisines(TypesHolder const & types) diff --git a/libs/indexer/feature_utils.hpp b/libs/indexer/feature_utils.hpp index 17a832924..94efe2285 100644 --- a/libs/indexer/feature_utils.hpp +++ b/libs/indexer/feature_utils.hpp @@ -137,7 +137,7 @@ std::string const GetReadableAddress(std::string const & address); // int8_t GetNameForSearchOnBooking(RegionData const & regionData, StringUtf8Multilang const & src, std::string & name); /// Returns preferred name when only the device language is available. -bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, std::string_view & out); +bool GetPreferredName(StringUtf8Multilang const & src, std::string_view & out); /// Returns priority list of language codes for feature description, /// the priority is the following: diff --git a/libs/indexer/mwm_set.hpp b/libs/indexer/mwm_set.hpp index d4c2bd1f5..977fb63a6 100644 --- a/libs/indexer/mwm_set.hpp +++ b/libs/indexer/mwm_set.hpp @@ -81,10 +81,12 @@ public: MwmTypeT GetType() const; + // Switch to following simplified code after this pull request has been included in one release: + // feature::RegionData GetRegionData() const { return m_data; } feature::RegionData GetRegionData() const { auto regionData = m_data; if (GetType() == MwmTypeT::WORLD || GetType() == MwmTypeT::COASTS) { - regionData.SetLanguages({"int_name","en","default"}); + regionData.SetLanguages({}); } return regionData; } diff --git a/libs/kml/type_utils.cpp b/libs/kml/type_utils.cpp index 3f7b980dc..89728a329 100644 --- a/libs/kml/type_utils.cpp +++ b/libs/kml/type_utils.cpp @@ -31,10 +31,8 @@ std::string GetPreferredBookmarkStr(LocalizableString const & name, std::string for (auto const & pair : name) nameMultilang.AddString(pair.first, pair.second); - auto const deviceLang = StringUtf8Multilang::GetLangIndex(languageNorm); - std::string_view preferredName; - if (feature::GetPreferredName(nameMultilang, deviceLang, preferredName)) + if (feature::GetPreferredName(nameMultilang, preferredName)) return std::string(preferredName); return {}; diff --git a/libs/platform/settings.cpp b/libs/platform/settings.cpp index 500906c13..d4e6be2ae 100644 --- a/libs/platform/settings.cpp +++ b/libs/platform/settings.cpp @@ -22,6 +22,7 @@ using std::string; std::string_view kMeasurementUnits = "Units"; std::string_view kMapLanguageCode = "MapLanguageCode"; +std::string_view kMapLanguageLimitAlternativesToLocal = "MapLanguageLimitAlternativesToLocal"; std::string_view kDeveloperMode = "DeveloperMode"; std::string_view kDonateUrl = "DonateUrl"; std::string_view kNY = "NY"; diff --git a/libs/platform/settings.hpp b/libs/platform/settings.hpp index 28001e366..8671755e3 100644 --- a/libs/platform/settings.hpp +++ b/libs/platform/settings.hpp @@ -12,6 +12,7 @@ namespace settings extern std::string_view kMeasurementUnits; extern std::string_view kDeveloperMode; extern std::string_view kMapLanguageCode; +extern std::string_view kMapLanguageLimitAlternativesToLocal; // The following two settings are configured externally at the metaserver. extern std::string_view kDonateUrl; extern std::string_view kNY; diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index c8660d625..f4e15ea7a 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -115,6 +115,7 @@ copy_resources( colors.txt copyright.html countries.txt + countries_meta.txt drules_proto_default_light.bin drules_proto_default_dark.bin drules_proto_outdoors_light.bin diff --git a/xcode/indexer/indexer.xcodeproj/project.pbxproj b/xcode/indexer/indexer.xcodeproj/project.pbxproj index d305b0d15..fbe114fe4 100644 --- a/xcode/indexer/indexer.xcodeproj/project.pbxproj +++ b/xcode/indexer/indexer.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 2711868B2F194FF000FD7FF3 /* feature_region_locator.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2711868A2F194FCF00FD7FF3 /* feature_region_locator.hpp */; }; + 2711868D2F194FF600FD7FF3 /* feature_region_locator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2711868C2F194FF400FD7FF3 /* feature_region_locator.cpp */; }; 272CA4462F126795005A3F5B /* ftypes_subtypes.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 272CA4442F126795005A3F5B /* ftypes_subtypes.hpp */; }; 272CA4472F126795005A3F5B /* ftypes_subtypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272CA4452F126795005A3F5B /* ftypes_subtypes.cpp */; }; 272CA44D2F12723B005A3F5B /* subtypes.csv in Resources */ = {isa = PBXBuildFile; fileRef = 272CA44C2F12723B005A3F5B /* subtypes.csv */; }; @@ -233,6 +235,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 2711868A2F194FCF00FD7FF3 /* feature_region_locator.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = feature_region_locator.hpp; sourceTree = ""; }; + 2711868C2F194FF400FD7FF3 /* feature_region_locator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = feature_region_locator.cpp; sourceTree = ""; }; 272CA4442F126795005A3F5B /* ftypes_subtypes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ftypes_subtypes.hpp; sourceTree = ""; }; 272CA4452F126795005A3F5B /* ftypes_subtypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ftypes_subtypes.cpp; sourceTree = ""; }; 272CA44C2F12723B005A3F5B /* subtypes.csv */ = {isa = PBXFileReference; lastKnownFileType = text; name = subtypes.csv; path = ../../data/subtypes.csv; sourceTree = ""; }; @@ -677,6 +681,8 @@ 675340C71A3F540F00A0A8C3 /* feature_impl.hpp */, 6726C1CF1A49DAAC005EEA39 /* feature_meta.cpp */, 6726C1D01A49DAAC005EEA39 /* feature_meta.hpp */, + 2711868C2F194FF400FD7FF3 /* feature_region_locator.cpp */, + 2711868A2F194FCF00FD7FF3 /* feature_region_locator.hpp */, 675340CC1A3F540F00A0A8C3 /* feature_processor.hpp */, 675B562120D25C9800A521D2 /* feature_source.cpp */, 675B562220D25C9800A521D2 /* feature_source.hpp */, @@ -794,6 +800,7 @@ 6753414C1A3F540F00A0A8C3 /* tree_structure.hpp in Headers */, F6DF5F311CD0FD9A00A87154 /* categories_index.hpp in Headers */, 40662D32236059BF006A124D /* tree_node.hpp in Headers */, + 2711868B2F194FF000FD7FF3 /* feature_region_locator.hpp in Headers */, 347F337D1C454242009758CC /* succinct_trie_builder.hpp in Headers */, 675341381A3F540F00A0A8C3 /* mwm_set.hpp in Headers */, 456E1B181F90E5B7009C32E1 /* cities_boundaries_serdes.hpp in Headers */, @@ -945,7 +952,7 @@ 3496ABA31DC1FA7200C5DDBA /* editor.config in Resources */, 3496AB9D1DC1FA5200C5DDBA /* drules_proto_clear.bin in Resources */, 3496AB9E1DC1FA5200C5DDBA /* drules_proto_dark.bin in Resources */, - 272CA44D2F12723B005A3F5B /* subtypes.csv in Resources */, + 272CA44D2F12723B005A3F5B /* subtypes.csv in Resources */, FA67C84F26BB36D700B33DCA /* categories_brands.txt in Resources */, FA67C84626BB356800B33DCA /* categories_cuisines.txt in Resources */, 3496ABA11DC1FA5200C5DDBA /* drules_proto.bin in Resources */, @@ -1041,6 +1048,7 @@ 272CA4472F126795005A3F5B /* ftypes_subtypes.cpp in Sources */, BBB7060F23E46E0100A7F29A /* isolines_info.cpp in Sources */, 408FE47724FEB95600F5D06D /* metadata_serdes.cpp in Sources */, + 2711868D2F194FF600FD7FF3 /* feature_region_locator.cpp in Sources */, 34583BCB1C88552100F94664 /* map_object.cpp in Sources */, 675B562320D25C9800A521D2 /* feature_source.cpp in Sources */, 6753412E1A3F540F00A0A8C3 /* index_builder.cpp in Sources */,