mirror of https://github.com/kiwix/libkiwix.git
Merge branch 'master' of ssh://git.code.sf.net/p/kiwix/kiwix
This commit is contained in:
commit
1faca99274
|
@ -34,16 +34,7 @@ namespace kiwix {
|
|||
resultRange(20)
|
||||
{
|
||||
template_ct2 = getResourceAsString("results.ct2");
|
||||
#ifdef __APPLE__
|
||||
string executablePath = getExecutablePath();
|
||||
string executableDirectory = removeLastPathElement(executablePath);
|
||||
string datPath = computeAbsolutePath(executableDirectory, "icudt49l.dat");
|
||||
try {
|
||||
u_setDataDirectory(datPath.c_str());
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
#endif
|
||||
loadICUExternalTables();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,20 @@
|
|||
|
||||
#include "stringTools.h"
|
||||
|
||||
/* tell ICU where to find its dat file (tables) */
|
||||
void kiwix::loadICUExternalTables() {
|
||||
#ifdef __APPLE__
|
||||
std::string executablePath = getExecutablePath();
|
||||
std::string executableDirectory = removeLastPathElement(executablePath);
|
||||
std::string datPath = computeAbsolutePath(executableDirectory, "icudt49l.dat");
|
||||
try {
|
||||
u_setDataDirectory(datPath.c_str());
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
|
||||
/* Prepare integer for display */
|
||||
|
@ -37,6 +51,7 @@ std::string kiwix::beautifyInteger(const unsigned int number) {
|
|||
}
|
||||
|
||||
std::string kiwix::removeAccents(const std::string &text) {
|
||||
loadICUExternalTables();
|
||||
ucnv_setDefaultName("UTF-8");
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Transliterator *removeAccentsTrans = Transliterator::createInstance("Lower; NFD; [:M:] remove; NFC", UTRANS_FORWARD, status);
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <pathTools.h>
|
||||
|
||||
namespace kiwix {
|
||||
|
||||
#ifndef __ANDROID__
|
||||
|
@ -48,6 +50,7 @@ namespace kiwix {
|
|||
|
||||
#endif
|
||||
|
||||
void loadICUExternalTables();
|
||||
std::string urlDecode(const std::string &c);
|
||||
|
||||
std::vector<std::string> split(const std::string&, const std::string&);
|
||||
|
|
Loading…
Reference in New Issue