At the moment PP does not display mixed RTL LTR texts correctly. Prefer native name for the user as we do it on a map and in the store version.

This commit is contained in:
Alex Zolotarev 2016-03-23 00:59:29 +03:00 committed by Sergey Yershov
parent 0652ac822e
commit 623df1d181
3 changed files with 15 additions and 17 deletions

View file

@ -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

View file

@ -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

View file

@ -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