Merge pull request #5847 from darina/pp-secondary-title

Into PP info added a wrapper for secondary feature name.
This commit is contained in:
Aleksandr Zatsepin 2017-04-17 15:19:30 +03:00 committed by GitHub
commit 44e50188dd
2 changed files with 22 additions and 5 deletions

View file

@ -59,15 +59,30 @@ string Info::GetTitle() const
if (!m_customName.empty())
return m_customName;
string name;
auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
auto const mwmInfo = GetID().m_mwmId.GetInfo();
string primaryName;
if (mwmInfo)
feature::GetReadableName(mwmInfo->GetRegionData(), m_name, deviceLang, true /* allowTranslit */, name);
{
auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
string secondaryName;
feature::GetPreferredNames(mwmInfo->GetRegionData(), m_name, deviceLang, true /* allowTranslit */, primaryName, secondaryName);
}
return primaryName;
}
return name;
string Info::GetSecondaryTitle() const
{
auto const mwmInfo = GetID().m_mwmId.GetInfo();
string secondaryName;
if (mwmInfo)
{
auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
string primaryName;
feature::GetPreferredNames(mwmInfo->GetRegionData(), m_name, deviceLang, true /* allowTranslit */, primaryName, secondaryName);
}
return secondaryName;
}
string Info::GetSubtitle() const

View file

@ -65,6 +65,8 @@ public:
/// Convenient wrapper for feature's name and custom name.
string GetTitle() const;
/// Convenient wrapper for secondary feature name.
string GetSecondaryTitle() const;
/// Convenient wrapper for type, cuisines, elevation, stars, wifi etc.
string GetSubtitle() const;
/// @returns empty string or GetStars() count of ★ symbol.