forked from organicmaps/organicmaps
Unzip archived ICU data on application start.
This commit is contained in:
parent
d13124d482
commit
d0568a836b
7 changed files with 30 additions and 11 deletions
1
android/assets/icudt57l.dat.zip
Symbolic link
1
android/assets/icudt57l.dat.zip
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../data/icudt57l.dat.zip
|
|
@ -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/
|
||||
|
|
BIN
data/icudt57l.dat.zip
Normal file
BIN
data/icudt57l.dat.zip
Normal file
Binary file not shown.
|
@ -85,18 +85,13 @@ void GetBestName(StringUtf8Multilang const & src, vector<int8_t> 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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<CityFinder>(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()
|
||||
|
|
|
@ -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* {
|
||||
|
|
Loading…
Add table
Reference in a new issue