[sword-svn] r3001 - in trunk: src/mgr tests

scribe at crosswire.org scribe at crosswire.org
Fri Jan 3 12:23:42 MST 2014


Author: scribe
Date: 2014-01-03 12:23:42 -0700 (Fri, 03 Jan 2014)
New Revision: 3001

Modified:
   trunk/src/mgr/localemgr.cpp
   trunk/tests/localetest.cpp
Log:
fixed fallback locale lookup when specific region is not found but a more general parent is available


Modified: trunk/src/mgr/localemgr.cpp
===================================================================
--- trunk/src/mgr/localemgr.cpp	2013-12-30 17:30:03 UTC (rev 3000)
+++ trunk/src/mgr/localemgr.cpp	2014-01-03 19:23:42 UTC (rev 3001)
@@ -264,12 +264,12 @@
 	stdstr(&defaultLocaleName, tmplang);
 
 	// First check for what we ask for
-	if (!getLocale(tmplang)) {
+	if (locales->find(tmplang) == locales->end()) {
 		// check for locale without country
 		char *nocntry=0;
 		stdstr(&nocntry, tmplang);
 		strtok(nocntry, "_");
-		if (getLocale(nocntry)) {
+		if (locales->find(nocntry) != locales->end()) {
 			stdstr(&defaultLocaleName, nocntry);
 		}
 		delete [] nocntry;

Modified: trunk/tests/localetest.cpp
===================================================================
--- trunk/tests/localetest.cpp	2013-12-30 17:30:03 UTC (rev 3000)
+++ trunk/tests/localetest.cpp	2014-01-03 19:23:42 UTC (rev 3001)
@@ -33,9 +33,9 @@
 		exit(-1);
 	}
 
-	LocaleMgr lm;
+	LocaleMgr *lm = LocaleMgr::getSystemLocaleMgr();
 
-	std::cout << lm.translate(argv[2], argv[1]) << "\n";
+	std::cout << lm->translate(argv[2], argv[1]) << "\n";
 
 /*
 	VerseKey bla;




More information about the sword-cvs mailing list