[sword-cvs] sword/src/mgr localemgr.cpp,1.20,1.21

sword at www.crosswire.org sword at www.crosswire.org
Fri May 7 11:00:12 MST 2004


Update of /cvs/core/sword/src/mgr
In directory www:/tmp/cvs-serv8471/src/mgr

Modified Files:
	localemgr.cpp 
Log Message:

dglassey: in setDefaultLocaleName strip everything after a "." so that you can use e.g. LANG=en_GB.UTF-8 and still get sword locales
en_US rather than en_us


Index: localemgr.cpp
===================================================================
RCS file: /cvs/core/sword/src/mgr/localemgr.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- localemgr.cpp	20 Apr 2004 12:03:10 -0000	1.20
+++ localemgr.cpp	7 May 2004 18:00:10 -0000	1.21
@@ -80,14 +80,14 @@
 	if (lang) {
 		if (strlen(lang) > 0)
 			setDefaultLocaleName(lang);
-		else setDefaultLocaleName("en_us");
+		else setDefaultLocaleName("en_US");
 	}
-	else setDefaultLocaleName("en_us");
+	else setDefaultLocaleName("en_US");
 
 	if (!iConfigPath)
 		SWMgr::findConfig(&configType, &prefixPath, &configPath);
 	else configPath = (char *)iConfigPath;
-
+	
 	if (prefixPath) {
 		switch (configType) {
 		case 2:
@@ -115,6 +115,8 @@
 
 	if (configPath)
 		delete [] configPath;
+	
+
 }
 
 
@@ -131,6 +133,7 @@
 	struct dirent *ent;
 	SWBuf newmodfile;
 	LocaleMap::iterator it;
+	printf("LocaleMgr::loadConfigDir loading %s", ipath);
  
 	if ((dir = opendir(ipath))) {
 		rewinddir(dir);
@@ -189,6 +192,7 @@
 	if (it != locales->end())
 		return (*it).second;
 
+	printf("LocaleMgr::getLocale failed to find %s\n", name);
 	return 0;
 }
 
@@ -220,7 +224,11 @@
 
 
 void LocaleMgr::setDefaultLocaleName(const char *name) {
-	stdstr(&defaultLocaleName, name);
+	char *tmplang=0;
+	stdstr(&tmplang, name);
+	strtok(tmplang, ".");
+	stdstr(&defaultLocaleName, tmplang);
+	delete [] tmplang;
 }
 
 SWORD_NAMESPACE_END




More information about the sword-cvs mailing list