Correctly print names in default and native for user language in Place Page.

This commit is contained in:
Alex Zolotarev 2016-03-22 23:08:34 +03:00 committed by Sergey Yershov
parent af1ee24fa3
commit 0ad9e520ba
3 changed files with 14 additions and 5 deletions

View file

@ -691,6 +691,11 @@ 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

View file

@ -26,13 +26,14 @@ string Info::FormatNewBookmarkName() const
string Info::GetTitle() const
{
string const defaultName = GetDefaultName();
if (m_customName.empty())
string const alt = m_customName.empty() ? m_nativeOrInternationalName : m_customName;
if (alt.empty())
return defaultName;
if (defaultName.empty())
return m_customName;
if (m_customName == defaultName)
return m_customName;
return m_customName + "(" + defaultName + ")";
return alt;
if (alt == defaultName)
return alt;
return defaultName + " (" + alt + ")";
}
string Info::GetSubtitle() const

View file

@ -65,5 +65,8 @@ 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