Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,43 @@
#include "storage/country_name_getter.hpp"
#include "base/assert.hpp"
namespace storage
{
void CountryNameGetter::SetLocale(std::string const & locale)
{
m_getCurLang = platform::GetTextByIdFactory(platform::TextSource::Countries, locale);
}
void CountryNameGetter::SetLocaleForTesting(std::string const & jsonBuffer, std::string const & locale)
{
m_getCurLang = platform::ForTestingGetTextByIdFactory(jsonBuffer, locale);
}
std::string CountryNameGetter::Get(std::string const & key) const
{
ASSERT(!key.empty(), ());
if (m_getCurLang == nullptr)
return std::string();
return (*m_getCurLang)(key);
}
std::string CountryNameGetter::operator()(CountryId const & countryId) const
{
std::string name = Get(countryId);
if (name.empty())
return countryId;
return name;
}
std::string CountryNameGetter::GetLocale() const
{
if (m_getCurLang == nullptr)
return std::string();
return m_getCurLang->GetLocale();
}
} // namespace storage