diff --git a/android/assets/icudt57l.dat.zip b/android/assets/icudt57l.dat.zip new file mode 120000 index 0000000000..a3f86e3e5a --- /dev/null +++ b/android/assets/icudt57l.dat.zip @@ -0,0 +1 @@ +../../data/icudt57l.dat.zip \ No newline at end of file diff --git a/android/script/replace_links.bat b/android/script/replace_links.bat index fe49651977..e457dda761 100644 --- a/android/script/replace_links.bat +++ b/android/script/replace_links.bat @@ -40,6 +40,8 @@ cp -r ../data/sound-strings/ assets/ cp -r ../data/countries-strings/ assets/ cp -r ../data/cuisine-strings/ assets/ +cp -r ../data/icudt57l.dat.zip/ assets/ + rm -rf flavors/mwm-ttf-assets mkdir flavors\\mwm-ttf-assets cp ../data/01_dejavusans.ttf flavors/mwm-ttf-assets/ diff --git a/data/icudt57l.dat.zip b/data/icudt57l.dat.zip new file mode 100644 index 0000000000..2edc529e8a Binary files /dev/null and b/data/icudt57l.dat.zip differ diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp index e35309a9b5..bb363e8b08 100644 --- a/indexer/feature_utils.cpp +++ b/indexer/feature_utils.cpp @@ -85,18 +85,13 @@ void GetBestName(StringUtf8Multilang const & src, vector const & priorit } } // namespace +void initICU(std::string const & icuDataDir) +{ + u_setDataDirectory(icuDataDir.c_str()); +} + std::string Transliterate(std::string const & str, std::string const & lang) { - class ICUDataInitializer - { - public: - ICUDataInitializer(std::string const & icuDataDir) - { - u_setDataDirectory(icuDataDir.c_str()); - } - }; - static ICUDataInitializer icuInitializer("../../../../../../omim/3party/icu/data/in/"); - UnicodeString ustr(str.c_str()); UErrorCode status = U_ZERO_ERROR; diff --git a/indexer/feature_utils.hpp b/indexer/feature_utils.hpp index 276aaaee6a..1588249104 100644 --- a/indexer/feature_utils.hpp +++ b/indexer/feature_utils.hpp @@ -7,6 +7,7 @@ struct FeatureID; class StringUtf8Multilang; +void initICU(std::string const & icuDataDir); std::string Transliterate(std::string const & str, std::string const & lang); namespace feature diff --git a/map/framework.cpp b/map/framework.cpp index 52dd67b65d..0d3dc78da9 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -130,6 +130,8 @@ char const kTrafficEnabledKey[] = "TrafficEnabled"; char const kTrafficSimplifiedColorsKey[] = "TrafficSimplifiedColors"; char const kLargeFontsSize[] = "LargeFontsSize"; +char const kICUDataFile[] = "icudt57l.dat"; + double const kDistEqualQueryMeters = 100.0; double const kLargeFontsScaleFactor = 1.6; size_t constexpr kMaxTrafficCacheSizeBytes = 64 /* Mb */ * 1024 * 1024; @@ -494,6 +496,21 @@ Framework::Framework() m_trafficManager.SetCurrentDataVersion(m_storage.GetCurrentDataVersion()); m_cityFinder = make_unique(m_model.GetIndex()); + + std::string const zippedData = std::string(kICUDataFile) + ".zip"; +#ifdef OMIM_OS_ANDROID + ZipFileReader::UnzipFile(GetPlatform().ResourcesDir(), + "assets/" + zippedData, + GetPlatform().WritableDir() + zippedData); + ZipFileReader::UnzipFile(GetPlatform().WritableDir() + zippedData, + kICUDataFile, + GetPlatform().WritableDir() + kICUDataFile); +#else + ZipFileReader::UnzipFile(GetPlatform().ResourcesDir() + zippedData, + kICUDataFile, + GetPlatform().WritableDir() + kICUDataFile); +#endif + initICU(GetPlatform().WritableDir()); } Framework::~Framework() diff --git a/qt/qt.pro b/qt/qt.pro index 95d46eea9e..bdcbc63629 100644 --- a/qt/qt.pro +++ b/qt/qt.pro @@ -88,10 +88,13 @@ OTHER_RES.files += ../data/fonts_blacklist.txt \ ../data/fonts_whitelist.txt \ ../data/unicode_blocks.txt +ICU_RES.path = $$DATADIR +ICU_RES.files = ../data/icudt57l.dat.zip + MWM_RES.path = $$DATADIR MWM_RES.files = ../data/World.mwm ../data/WorldCoasts.mwm -ALL_RESOURCES = OTHER_RES CLASSIFICATOR_RES MDPI_SKIN_RES XHDPI_SKIN_RES FONT_RES MWM_RES +ALL_RESOURCES = OTHER_RES CLASSIFICATOR_RES MDPI_SKIN_RES XHDPI_SKIN_RES FONT_RES MWM_RES ICU_RES #ALL_RESOURCES += DEFAULT_SKIN_RES linux* {