79 std::list<SWBuf> augPaths;
80 ConfigEntMap::iterator entry;
85 SWLOGTI(
"LOOKING UP LOCALE DIRECTORY...");
88 if ((entry = sysConf->
getSection(
"Install").find(
"LocalePath")) != sysConf->
getSection(
"Install").end()) {
90 stdstr(&prefixPath, (
char *)entry->second.c_str());
91 SWLOGTI(
"LocalePath provided in sysConfig.");
94 SWLOGTI(
"LOOKING UP LOCALE DIRECTORY COMPLETE.");
101 switch (configType) {
104 for (i = (
int)strlen(configPath)-1; ((i) && (configPath[i] !=
'/') && (configPath[i] !=
'\\')); i--);
111 if ((prefixPath[strlen(prefixPath)-1] !=
'\\') && (prefixPath[strlen(prefixPath)-1] !=
'/'))
122 if (augPaths.size() && configType != 9) {
123 std::list<SWBuf>::iterator it = augPaths.begin();
124 std::list<SWBuf>::iterator end = augPaths.end();
126 for (;it != end; ++it) {
128 SWBuf path = (*it) +
"locales.d";
140 delete [] prefixPath;
143 delete [] configPath;
159 LocaleMap::iterator it;
160 SWLOGD(
"LocaleMgr::loadConfigDir loading %s", ipath);
166 for (
unsigned int i = 0; i < dirList.size(); ++i) {
167 if (dirList[i].name.endsWith(
".conf")) {
169 localeFile = baseDir + dirList[i].name;
173 bool supported =
false;
188 *((*it).second) += *locale;
191 else locales->insert(LocaleMap::value_type(locale->
getName(), locale));
201 LocaleMap::iterator it;
211 LocaleMap::iterator it;
223 std::list <SWBuf> retVal;
224 for (LocaleMap::iterator it =
locales->begin(); it !=
locales->end(); it++) {
225 if (strcmp(it->second->getName(),
"locales")) {
226 retVal.push_back((*it).second->getName());
255 strtok(tmplang,
".");
257 strtok(tmplang,
"@");
265 stdstr(&nocntry, tmplang);
266 strtok(nocntry,
"_");
#define SWORD_NAMESPACE_START
__staticsystemLocaleMgr()
virtual void setDefaultLocaleName(const char *name)
static signed char existsDir(const char *ipath, const char *idirName=0)
static bool hasUTF8Support()
static SWLog * getSystemLog()
virtual const char * getDefaultLocaleName()
virtual void loadConfigDir(const char *ipath)
~__staticsystemLocaleMgr()
LocaleMgr(const LocaleMgr &)
bool endsWith(const SWBuf &postfix) const
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
ConfigEntMap & getSection(const char *section)
virtual SWLocale * getLocale(const char *name)
const char * c_str() const
static const char * DEFAULT_LOCALE_NAME
static LocaleMgr * getSystemLocaleMgr()
std::map< SWBuf, SWLocale *, std::less< SWBuf > > LocaleMap
virtual const char * translate(const char *text, const char *localeName=0)
virtual const char * translate(const char *text)
static std::vector< struct DirEntry > getDirList(const char *dirPath, bool includeSize=false, bool includeIsDirectory=true)
void logWarning(const char *fmt,...) const
static void setSystemLocaleMgr(LocaleMgr *newLocaleMgr)
static void findConfig(char *configType, char **prefixPath, char **configPath, StringList *augPaths=0, SWConfig **providedSysConf=0)
virtual StringList getAvailableLocales()
class __staticsystemLocaleMgr _staticsystemLocaleMgr
static LocaleMgr * systemLocaleMgr
#define SWORD_NAMESPACE_END
virtual const char * getEncoding()
virtual const char * getName()