diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index eed0db0662..26d0a20449 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -196,7 +196,7 @@ bool Info::HasBanner() const if (IsMyPosition()) return false; - return m_adsEngine->HasBanner(m_types, m_topmostCountryIds); + return m_adsEngine->HasBanner(m_types, m_topmostCountryIds, languages::GetCurrentNorm()); } vector Info::GetBanners() const @@ -204,7 +204,7 @@ vector Info::GetBanners() const if (!m_adsEngine) return {}; - return m_adsEngine->GetBanners(m_types, m_topmostCountryIds); + return m_adsEngine->GetBanners(m_types, m_topmostCountryIds, languages::GetCurrentNorm()); } bool Info::IsReachableByTaxi() const diff --git a/partners_api/ads_base.cpp b/partners_api/ads_base.cpp index 7ed510c415..a6f97c11de 100644 --- a/partners_api/ads_base.cpp +++ b/partners_api/ads_base.cpp @@ -3,6 +3,8 @@ #include "indexer/classificator.hpp" #include "indexer/feature_data.hpp" +#include "coding/multilang_utf8_string.hpp" + #include namespace ads @@ -27,21 +29,36 @@ void Container::AppendSupportedCountries( m_supportedCountries.insert(countries.begin(), countries.end()); } +void Container::AppendSupportedUserLanguages(std::initializer_list const & languages) +{ + for (auto const & language : languages) + { + int8_t const langIndex = StringUtf8Multilang::GetLangIndex(language); + if (langIndex == StringUtf8Multilang::kUnsupportedLanguageCode) + continue; + m_supportedUserLanguages.insert(langIndex); + } +} + bool Container::HasBanner(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const + storage::TCountryId const & countryId, + std::string const & userLanguage) const { if (!m_supportedCountries.empty() && m_supportedCountries.find(countryId) == m_supportedCountries.end()) { - return false; + auto const userLangCode = StringUtf8Multilang::GetLangIndex(userLanguage); + if (m_supportedUserLanguages.find(userLangCode) == m_supportedUserLanguages.end()) + return false; } return !m_excludedTypes.Contains(types); } std::string Container::GetBannerId(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const + storage::TCountryId const & countryId, + std::string const & userLanguage) const { - if (!HasBanner(types, countryId)) + if (!HasBanner(types, countryId, userLanguage)) return {}; auto const it = m_typesToBanners.Find(types); diff --git a/partners_api/ads_base.hpp b/partners_api/ads_base.hpp index d1e9b563ad..7f3b85c9ab 100644 --- a/partners_api/ads_base.hpp +++ b/partners_api/ads_base.hpp @@ -23,9 +23,11 @@ class ContainerBase public: virtual ~ContainerBase() = default; virtual bool HasBanner(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const = 0; + storage::TCountryId const & countryId, + std::string const & userLanguage) const = 0; virtual std::string GetBannerId(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const = 0; + storage::TCountryId const & countryId, + std::string const & userLanguage) const = 0; virtual std::string GetBannerIdForOtherTypes() const = 0; virtual bool HasSearchBanner() const = 0; virtual std::string GetSearchBannerId() const = 0; @@ -39,9 +41,11 @@ public: // ContainerBase overrides: bool HasBanner(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const override; + storage::TCountryId const & countryId, + std::string const & userLanguage) const override; std::string GetBannerId(feature::TypesHolder const & types, - storage::TCountryId const & countryId) const override; + storage::TCountryId const & countryId, + std::string const & userLanguage) const override; std::string GetBannerIdForOtherTypes() const override; bool HasSearchBanner() const override; std::string GetSearchBannerId() const override; @@ -51,12 +55,16 @@ protected: std::string const & id); void AppendExcludedTypes(std::initializer_list> && types); void AppendSupportedCountries(std::initializer_list const & countries); + void AppendSupportedUserLanguages(std::initializer_list const & languages); private: ftypes::HashMapMatcher m_typesToBanners; ftypes::HashSetMatcher m_excludedTypes; // All countries are supported when empty. std::unordered_set m_supportedCountries; + // It supplements |m_supportedCountries|. If a country isn't supported + // we check user's language. + std::unordered_set m_supportedUserLanguages; DISALLOW_COPY(Container); }; diff --git a/partners_api/ads_engine.cpp b/partners_api/ads_engine.cpp index 84dab380fa..e7f0e75c2b 100644 --- a/partners_api/ads_engine.cpp +++ b/partners_api/ads_engine.cpp @@ -20,13 +20,14 @@ Engine::Engine() } bool Engine::HasBanner(feature::TypesHolder const & types, - storage::TCountriesVec const & countryIds) const + storage::TCountriesVec const & countryIds, + std::string const & userLanguage) const { for (auto const & countryId : countryIds) { for (auto const & item : m_banners) { - if (item.m_container->HasBanner(types, countryId)) + if (item.m_container->HasBanner(types, countryId, userLanguage)) return true; } } @@ -35,7 +36,8 @@ bool Engine::HasBanner(feature::TypesHolder const & types, } std::vector Engine::GetBanners(feature::TypesHolder const & types, - storage::TCountriesVec const & countryIds) const + storage::TCountriesVec const & countryIds, + std::string const & userLanguage) const { std::vector result; @@ -43,7 +45,7 @@ std::vector Engine::GetBanners(feature::TypesHolder const & types, { for (auto const & countryId : countryIds) { - auto const bannerId = item.m_container->GetBannerId(types, countryId); + auto const bannerId = item.m_container->GetBannerId(types, countryId, userLanguage); // We need to add banner for every banner system just once. if (!bannerId.empty()) { diff --git a/partners_api/ads_engine.hpp b/partners_api/ads_engine.hpp index b6e90a70ce..e07578a8c4 100644 --- a/partners_api/ads_engine.hpp +++ b/partners_api/ads_engine.hpp @@ -19,9 +19,12 @@ class Engine public: Engine(); - bool HasBanner(feature::TypesHolder const & types, storage::TCountriesVec const & countryIds) const; + bool HasBanner(feature::TypesHolder const & types, + storage::TCountriesVec const & countryIds, + std::string const & userLanguage) const; std::vector GetBanners(feature::TypesHolder const & types, - storage::TCountriesVec const & countryIds) const; + storage::TCountriesVec const & countryIds, + std::string const & userLanguage) const; bool HasSearchBanner() const; std::vector GetSearchBanners() const; diff --git a/partners_api/partners_api_tests/ads_engine_tests.cpp b/partners_api/partners_api_tests/ads_engine_tests.cpp index f01aa6c441..a63bf88ec7 100644 --- a/partners_api/partners_api_tests/ads_engine_tests.cpp +++ b/partners_api/partners_api_tests/ads_engine_tests.cpp @@ -35,62 +35,62 @@ UNIT_TEST(AdsEngine_Smoke) { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); - TEST(engine.HasBanner(holder, {"Ukraine"}), ()); - auto result = engine.GetBanners(holder, {"Ukraine"}); + TEST(engine.HasBanner(holder, {"Ukraine"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Ukraine"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"7", mopub.GetBannerIdForOtherTypes()}); holder.Add(c.GetTypeByPath({"amenity", "pub"})); - TEST(engine.HasBanner(holder, {"Ukraine"}), ()); - result = engine.GetBanners(holder, {"Ukraine"}); + TEST(engine.HasBanner(holder, {"Ukraine"}, "ru"), ()); + result = engine.GetBanners(holder, {"Ukraine"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"7", mopub.GetBannerIdForOtherTypes()}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"tourism", "information", "map"})); - TEST(engine.HasBanner(holder, {"Moldova"}), ()); - auto result = engine.GetBanners(holder, {"Moldova"}); + TEST(engine.HasBanner(holder, {"Moldova"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Moldova"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"5", "d298f205fb8a47aaafb514d2b5b8cf55"}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"shop", "ticket"})); - TEST(engine.HasBanner(holder, {"Russian Federation"}), ()); - auto result = engine.GetBanners(holder, {"Russian Federation"}); + TEST(engine.HasBanner(holder, {"Russian Federation"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Russian Federation"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"2", "d298f205fb8a47aaafb514d2b5b8cf55"}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "bank"})); - TEST(engine.HasBanner(holder, {"Belarus"}), ()); - auto result = engine.GetBanners(holder, {"Belarus"}); + TEST(engine.HasBanner(holder, {"Belarus"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Belarus"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"8", mopub.GetBannerIdForOtherTypes()}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "pub"})); - TEST(engine.HasBanner(holder, {"Spain", "Ukraine"}), ()); - auto result = engine.GetBanners(holder, {"Spain", "Ukraine"}); + TEST(engine.HasBanner(holder, {"Spain", "Ukraine"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Spain", "Ukraine"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"1", "d298f205fb8a47aaafb514d2b5b8cf55"}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "pub"})); - TEST(engine.HasBanner(holder, {"Ukraine", "Spain"}), ()); - auto result = engine.GetBanners(holder, {"Ukraine", "Spain"}); + TEST(engine.HasBanner(holder, {"Ukraine", "Spain"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Ukraine", "Spain"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {"1", "d298f205fb8a47aaafb514d2b5b8cf55"}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "pub"})); - TEST(engine.HasBanner(holder, {"Spain"}), ()); - auto result = engine.GetBanners(holder, {"Spain"}); + TEST(engine.HasBanner(holder, {"Spain"}, "en"), ()); + auto result = engine.GetBanners(holder, {"Spain"}, "en"); CheckIds(result, {"d298f205fb8a47aaafb514d2b5b8cf55"}); TEST_EQUAL(result[0].m_type, ads::Banner::Type::Mopub, ()); } @@ -98,32 +98,40 @@ UNIT_TEST(AdsEngine_Smoke) { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "toilets"})); - TEST(engine.HasBanner(holder, {"Armenia"}), ()); - auto result = engine.GetBanners(holder, {"Armenia"}); + TEST(engine.HasBanner(holder, {"Armenia"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Armenia"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {rb.GetBannerIdForOtherTypes(), mopub.GetBannerIdForOtherTypes()}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "toilets"})); - TEST(engine.HasBanner(holder, {"Armenia", "Azerbaijan Region"}), ()); - auto result = engine.GetBanners(holder, {"Armenia", "Azerbaijan Region"}); + TEST(engine.HasBanner(holder, {"Armenia", "Azerbaijan Region"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Armenia", "Azerbaijan Region"}, "ru"); CheckCountAndTypes(result); CheckIds(result, {rb.GetBannerIdForOtherTypes(), mopub.GetBannerIdForOtherTypes()}); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); - TEST(engine.HasBanner(holder, {"Brazil"}), ()); - auto result = engine.GetBanners(holder, {"Brazil"}); + TEST(engine.HasBanner(holder, {"Brazil"}, "en"), ()); + auto result = engine.GetBanners(holder, {"Brazil"}, "en"); CheckIds(result, {mopub.GetBannerIdForOtherTypes()}); TEST_EQUAL(result[0].m_type, ads::Banner::Type::Mopub, ()); } + { + feature::TypesHolder holder; + holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); + TEST(engine.HasBanner(holder, {"Brazil"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Brazil"}, "ru"); + CheckCountAndTypes(result); + CheckIds(result, {rb.GetBannerIdForOtherTypes(), mopub.GetBannerIdForOtherTypes()}); + } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "booking"})); - TEST(!engine.HasBanner(holder, {"Russian Federation"}), ()); - auto result = engine.GetBanners(holder, {"Russian Federation"}); + TEST(!engine.HasBanner(holder, {"Russian Federation"}, "ru"), ()); + auto result = engine.GetBanners(holder, {"Russian Federation"}, "ru"); TEST(result.empty(), ()); } { diff --git a/partners_api/partners_api_tests/facebook_tests.cpp b/partners_api/partners_api_tests/facebook_tests.cpp index 55ff3886bf..f3a7f9983f 100644 --- a/partners_api/partners_api_tests/facebook_tests.cpp +++ b/partners_api/partners_api_tests/facebook_tests.cpp @@ -16,41 +16,41 @@ UNIT_TEST(Facebook_GetBanner) { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); - TEST_EQUAL(facebook.GetBannerId(holder, "Brazil"), facebook.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Brazil", "ru"), facebook.GetBannerIdForOtherTypes(), ()); holder.Add(c.GetTypeByPath({"amenity", "pub"})); - TEST_EQUAL(facebook.GetBannerId(holder, "Cuba"), facebook.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Cuba", "ru"), facebook.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Add(c.GetTypeByPath({"amenity", "restaurant"})); - TEST_EQUAL(facebook.GetBannerId(holder, "Any country"), facebook.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Any country", "ru"), facebook.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"tourism", "information", "map"})); - TEST_EQUAL(facebook.GetBannerId(holder, "Russia"), facebook.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Russia", "ru"), facebook.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"shop", "ticket"})); - TEST_EQUAL(facebook.GetBannerId(holder, "USA"), facebook.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(facebook.GetBannerId(holder, "USA", "ru"), facebook.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "toilets"})); auto const bannerId = facebook.GetBannerIdForOtherTypes(); - TEST_EQUAL(facebook.GetBannerId(holder, "Spain"), bannerId, ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Spain", "ru"), bannerId, ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); auto const bannerId = facebook.GetBannerIdForOtherTypes(); - TEST_EQUAL(facebook.GetBannerId(holder, "Denmark"), bannerId, ()); + TEST_EQUAL(facebook.GetBannerId(holder, "Denmark", "ru"), bannerId, ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "booking"})); - TEST_EQUAL(facebook.GetBannerId(holder, "India"), "", ()); + TEST_EQUAL(facebook.GetBannerId(holder, "India", "ru"), "", ()); } } } // namespace diff --git a/partners_api/partners_api_tests/mopub_tests.cpp b/partners_api/partners_api_tests/mopub_tests.cpp index 0331fa40ad..880a9bb04d 100644 --- a/partners_api/partners_api_tests/mopub_tests.cpp +++ b/partners_api/partners_api_tests/mopub_tests.cpp @@ -16,49 +16,49 @@ UNIT_TEST(Mopub_GetBanner) { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Brazil"), mopub.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Brazil", "ru"), mopub.GetBannerIdForOtherTypes(), ()); holder.Add(c.GetTypeByPath({"amenity", "pub"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Cuba"), mopub.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Cuba", "ru"), mopub.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Add(c.GetTypeByPath({"amenity", "restaurant"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Any country"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Any country", "ru"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"tourism", "information", "map"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Russia"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Russia", "ru"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"highway", "speed_camera"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Egypt"), "fbd54c31a20347a6b5d6654510c542a4", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Egypt", "ru"), "fbd54c31a20347a6b5d6654510c542a4", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"building"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Russia"), "fbd54c31a20347a6b5d6654510c542a4", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Russia", "ru"), "fbd54c31a20347a6b5d6654510c542a4", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"shop", "ticket"})); - TEST_EQUAL(mopub.GetBannerId(holder, "USA"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "USA", "ru"), "d298f205fb8a47aaafb514d2b5b8cf55", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "toilets"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Spain"), mopub.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Spain", "ru"), mopub.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); - TEST_EQUAL(mopub.GetBannerId(holder, "Denmark"), mopub.GetBannerIdForOtherTypes(), ()); + TEST_EQUAL(mopub.GetBannerId(holder, "Denmark", "ru"), mopub.GetBannerIdForOtherTypes(), ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "booking"})); - TEST_EQUAL(mopub.GetBannerId(holder, "India"), "", ()); + TEST_EQUAL(mopub.GetBannerId(holder, "India", "ru"), "", ()); } } } // namespace diff --git a/partners_api/partners_api_tests/rb_tests.cpp b/partners_api/partners_api_tests/rb_tests.cpp index e1ddd7005f..278bbffd8e 100644 --- a/partners_api/partners_api_tests/rb_tests.cpp +++ b/partners_api/partners_api_tests/rb_tests.cpp @@ -16,66 +16,66 @@ UNIT_TEST(Rb_GetBanner) { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "7", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "7", ()); holder.Add(c.GetTypeByPath({"amenity", "pub"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "7", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "7", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "restaurant"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "1", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "1", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"tourism", "information", "map"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "5", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "5", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"shop", "ticket"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "2", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "2", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "bank"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "8", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "8", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "atm"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "8", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "8", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "bureau_de_change"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "8", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "8", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "atm"})); - TEST_EQUAL(rb.GetBannerId(holder, "Brazil"), "", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Brazil", "en"), "", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"amenity", "toilets"})); auto const bannerId = rb.GetBannerIdForOtherTypes(); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), bannerId, ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), bannerId, ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); auto const bannerId = rb.GetBannerIdForOtherTypes(); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), bannerId, ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), bannerId, ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "opentable"})); - TEST_EQUAL(rb.GetBannerId(holder, "Brazil"), "", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Brazil", "ru"), "14", ()); } { feature::TypesHolder holder; holder.Assign(c.GetTypeByPath({"sponsored", "booking"})); - TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation"), "", ()); + TEST_EQUAL(rb.GetBannerId(holder, "Russian Federation", "ru"), "", ()); } } } // namespace diff --git a/partners_api/rb_ads.cpp b/partners_api/rb_ads.cpp index d2f358ae19..809df01149 100644 --- a/partners_api/rb_ads.cpp +++ b/partners_api/rb_ads.cpp @@ -29,6 +29,8 @@ std::initializer_list const kSupportedCountries = "Uzbekistan", "Ukraine" }; + +std::initializer_list const kSupportedLanguages = {"be", "hy", "kk", "ru", "uk"}; } // namespace namespace ads @@ -103,6 +105,7 @@ Rb::Rb() AppendEntry({{"building"}}, kBuildingPlacementId); AppendSupportedCountries(kSupportedCountries); + AppendSupportedUserLanguages(kSupportedLanguages); } std::string Rb::GetBannerIdForOtherTypes() const