diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp index 382d21f7f9..c3871b2628 100644 --- a/indexer/categories_holder.cpp +++ b/indexer/categories_holder.cpp @@ -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; } diff --git a/indexer/categories_holder.hpp b/indexer/categories_holder.hpp index ba40e43460..84800bf9b0 100644 --- a/indexer/categories_holder.hpp +++ b/indexer/categories_holder.hpp @@ -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;