diff --git a/map/framework.cpp b/map/framework.cpp index fd0d170655..b3881b14fd 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -691,11 +691,6 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info info.SetFromFeatureType(ft); info.m_isEditable = osm::Editor::Instance().GetEditableProperties(ft).IsEditable(); info.m_localizedWifiString = m_stringsBundle.GetString("wifi"); - // TODO: Move FeatureType::GetPreferredNames() code into a separate reusable function which can be used - // directly from place_page::Info getter, instead of storing it's result in the variable. - string defaultName, intName; - ft.GetPreferredNames(defaultName, intName); - info.m_nativeOrInternationalName = intName; } void Framework::FillApiMarkInfo(ApiMarkPoint const & api, place_page::Info & info) const diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index fe6fd73255..b0fc8fae2c 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -2,6 +2,8 @@ #include "indexer/osm_editor.hpp" +#include "platform/preferred_languages.hpp" + namespace place_page { char const * Info::kSubtitleSeparator = " • "; @@ -25,15 +27,19 @@ string Info::FormatNewBookmarkName() const string Info::GetTitle() const { - string const defaultName = GetDefaultName(); - string const alt = m_customName.empty() ? m_nativeOrInternationalName : m_customName; - if (alt.empty()) - return defaultName; - if (defaultName.empty()) - return alt; - if (alt == defaultName) - return alt; - return defaultName + " (" + alt + ")"; + if (!m_customName.empty()) + return m_customName; + + // Prefer names in native language over default ones. + int8_t const langCode = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm()); + if (langCode != StringUtf8Multilang::kUnsupportedLanguageCode) + { + string native; + if (m_name.GetString(langCode, native)) + return native; + } + + return GetDefaultName(); } string Info::GetSubtitle() const diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index ef8e246d2d..1c8e84906a 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -65,8 +65,5 @@ public: // TODO(AlexZ): Temporary solution. It's better to use a wifi icon in UI instead of text. string m_localizedWifiString; - // TODO: Move FeatureType::GetPreferredNames() code into a separate reusable function which can be used - // directly from place_page::Info getter, instead of storing it's result in the variable. - string m_nativeOrInternationalName; }; } // namespace place_page