Transliteration lazy initilation

This commit is contained in:
LaGrunge 2019-08-06 16:29:01 +03:00 committed by cc-engineering
parent 51f166dad0
commit 782922991a
2 changed files with 14 additions and 2 deletions

View file

@ -10,7 +10,6 @@
#include "generator/regions/regions_builder.hpp"
#include "geometry/mercator.hpp"
#include "platform/platform.hpp"
#include "coding/transliteration.hpp"
@ -59,7 +58,6 @@ public:
{
LOG(LINFO, ("Start generating regions from", m_pathInRegionsTmpMwm));
auto timer = base::Timer{};
Transliteration::Instance().Init(GetPlatform().ResourcesDir());
RegionsBuilder::Regions regions;
PlacePointsMap placePointsMap;

View file

@ -4,6 +4,8 @@
#include "coding/transliteration.hpp"
#include "platform/platform.hpp"
#include <unordered_map>
namespace
@ -19,11 +21,23 @@ const std::unordered_map<generator::LanguageCode, Languages> kPreferredLanguages
Languages kLocalelanguages = {"en", "ru"};
} // namespace
namespace
{
struct TransliterationInitilizer
{
TransliterationInitilizer()
{
Transliteration::Instance().Init(GetPlatform().ResourcesDir());
}
};
} // namespace
namespace generator
{
std::string GetTranslatedOrTransliteratedName(StringUtf8Multilang const & name,
LanguageCode languageCode)
{
static TransliterationInitilizer littleStaticHelperToPreventMisinitilizedTranslations;
std::string s = GetName(name, languageCode);
if (!s.empty())
return s;