diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-07 21:38:56 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:51:28 +0300 |
commit | ea3fee3d72bc1ac62b59ae2901d408ace8a5a63c (patch) | |
tree | f964d78fad8bf3f5a98f174a7118bc5808f59864 /indexer/categories_holder.cpp | |
parent | 32742a73c6ded2e95a18a35b9220264e773ef3cc (diff) |
Correct fix to display either translated category name for type (or it’s base type), or untranslated name.
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r-- | indexer/categories_holder.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp index 7ee9084732..e6678c55ca 100644 --- a/indexer/categories_holder.cpp +++ b/indexer/categories_holder.cpp @@ -202,10 +202,23 @@ bool CategoriesHolder::GetNameByType(uint32_t type, int8_t locale, string & name string CategoriesHolder::GetReadableFeatureType(uint32_t type, int8_t locale) const { ASSERT_NOT_EQUAL(type, 0, ()); + uint8_t level = ftype::GetLevel(type); + ASSERT_GREATER(level, 0, ()); + + uint32_t originalType = type; string name; - if (GetNameByType(type, locale, name)) - return name; - return classif().GetReadableObjectName(type); + while (true) + { + if (GetNameByType(type, locale, name)) + return name; + + if (--level == 0) + break; + + ftype::TruncValue(type, level); + } + + return classif().GetReadableObjectName(originalType); } bool CategoriesHolder::IsTypeExist(uint32_t type) const |