forked from organicmaps/organicmaps
Merge pull request #5419 from darina/category-name-fix
Use en category name if there is no translation for current locale
This commit is contained in:
commit
5fc2b592f1
2 changed files with 8 additions and 3 deletions
|
@ -314,6 +314,7 @@ bool CategoriesHolder::GetNameByType(uint32_t type, int8_t locale, string & name
|
|||
{
|
||||
auto const range = m_type2cat.equal_range(type);
|
||||
|
||||
string enName;
|
||||
for (auto it = range.first; it != range.second; ++it)
|
||||
{
|
||||
Category const & cat = *it->second;
|
||||
|
@ -324,12 +325,16 @@ bool CategoriesHolder::GetNameByType(uint32_t type, int8_t locale, string & name
|
|||
name = synonym.m_name;
|
||||
return true;
|
||||
}
|
||||
else if (enName.empty() && (synonym.m_locale == kEnglishCode))
|
||||
{
|
||||
enName = synonym.m_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (range.first != range.second)
|
||||
if (!enName.empty())
|
||||
{
|
||||
name = range.first->second->m_synonyms[0].m_name;
|
||||
name = enName;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
inline GroupTranslations const & GetGroupTranslations() const { return m_groupTranslations; }
|
||||
|
||||
/// Search name for type with preffered locale language.
|
||||
/// If no name for this language, return first (en) name.
|
||||
/// If no name for this language, return en name.
|
||||
/// @return false if no categories for type.
|
||||
bool GetNameByType(uint32_t type, int8_t locale, string & name) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue