[sword-svn] r3189 - in branches/sword-1-7-x: . utilities/diatheke

greg.hellings at crosswire.org greg.hellings at crosswire.org
Wed Apr 16 22:00:28 MST 2014


Author: greg.hellings
Date: 2014-04-16 22:00:28 -0700 (Wed, 16 Apr 2014)
New Revision: 3189

Modified:
   branches/sword-1-7-x/
   branches/sword-1-7-x/utilities/diatheke/corediatheke.cpp
   branches/sword-1-7-x/utilities/diatheke/corediatheke.h
Log:
Fix broken merge to diatheke.



Property changes on: branches/sword-1-7-x
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:2989-2991,2997,3001-3004,3006,3010-3013,3015-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155
   + /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155

Modified: branches/sword-1-7-x/utilities/diatheke/corediatheke.cpp
===================================================================
--- branches/sword-1-7-x/utilities/diatheke/corediatheke.cpp	2014-04-17 04:35:02 UTC (rev 3188)
+++ branches/sword-1-7-x/utilities/diatheke/corediatheke.cpp	2014-04-17 05:00:28 UTC (rev 3189)
@@ -122,15 +122,27 @@
 	ConfigEntMap::iterator eit;
 	const char * DEFAULT_FONT = "Gentium";
 	SWModule *target;
-	const char *font = 0;
+	
+	char *font = 0;
+	SWBuf modlanguage;
+	SWBuf modlocale;
+	SWBuf syslanguage;
+	SWBuf syslocale;
 	char inputformat = 0;
 	SWBuf encoding;
 	char querytype = 0;
 
-	if (locale) {
-		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale);
+	if (!locale) { locale = "en";
 	}
 
+
+	syslocale = SWBuf(locale);
+	syslocale.append(".en");
+	LocaleMgr *lom = LocaleMgr::getSystemLocaleMgr();
+	lom->setDefaultLocaleName(syslocale);
+	syslanguage = lom->translate(syslocale, "locales");
+	
+	
 	//deal with queries to "system"
 	if (!::stricmp(text, "system")) {
 		querytype = QT_SYSTEM;
@@ -148,6 +160,19 @@
 	target = (*it).second;
 	SWKey *p = target->createKey();
         VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+        
+        
+	if (target->getLanguage()) {
+		modlocale = target->getLanguage();
+		LocaleMgr *lm = LocaleMgr::getSystemLocaleMgr();
+		modlanguage = lm->translate(modlocale.append(".en"), "locales");
+		modlocale -= 3; 			
+		}
+	else {
+		modlocale = "en";
+		modlanguage = "English";
+		} 
+
 	if (!parser) {
         	delete p;
 	        parser = new VerseKey();
@@ -314,16 +339,17 @@
 			*output << ";}}";
 		}
 		else if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML) {
-			*output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
+			*output << "<meta http-equiv=\"content-type\" content=\"text/html\" charset=\"UTF-8\""
+				   " lang=\"" << locale << "\" xml:lang=\"" << locale << "\"/>";
 		}
 
+
 		if (text.length()) {
 			*output << (char*)target->getKeyText();
-			if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
-				*output << ": <span ";
-				if (font) { *output << "style=\"font:\"" << font << ";\""; }
-				if (strcmp(modlocale,locale) !=0 ) { *output << "lang=\"" << modlocale << "\"";}
-				*output << ">";
+			*output << (char*)target->getKeyText();
+			if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
+				*output << ": <span style=\"font:\"" << font << ";\""
+				        << " lang=\"" << modlocale << "\">";
 			}
 			else if (outputformat == FMT_RTF) {
 				*output << ": {\\f1 ";
@@ -333,15 +359,13 @@
 			}
 			*output << text;
 			if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
-				*output << "</font>";
+				*output << "</span>";
 			}
 			else if (outputformat == FMT_RTF) {
 				*output << "}";
 			}
 
-			*output << "(";
-			*output << target->getName();
-			*output << ")\n";
+			*output << "(" << target->getName() << ")\n";
 		}
 
 		if (outputformat == FMT_RTF) {
@@ -373,7 +397,7 @@
 		}
 		else if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML) {
 			*output << "<meta http-equiv=\"content-type\" content=\"text/html\" charset=\"UTF-8\""
-				   " lang=\"" <<  locale << "\" xml:lang=\"" <<   locale << "\"/>\n";
+				   " lang=\"" <<  locale << "\" xml:lang=\"" <<   locale << "\"/>";
 		}
 
 		for (i = 0; i < listkey.getCount() && maxverses; i++) {
@@ -389,6 +413,9 @@
 						if (strcmp(modlocale,locale) !=0 ) { *output << "lang=\"" << modlocale << "\"";}
 						*output << ">";
 					}
+					if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
+						*output << ": <span style=\"font:\""  << font << ";\"" << " lang=\"" << modlocale << "\">";
+					}
 					else if (outputformat == FMT_RTF) {
 						*output << ": {\\f1 ";
 					}
@@ -397,7 +424,7 @@
 					}
 					*output << target->renderText();
 					if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
-						*output << "</font>";
+						*output << "</span>";
 					}
 					else if (outputformat == FMT_RTF) {
 						*output << "}";
@@ -429,6 +456,11 @@
 						if (strcmp(modlocale,locale) !=0 ) { *output << "lang=\"" << modlocale << "\"";}
 						*output << ">";
 					}
+				}	
+
+				if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
+					*output << ": <font face=\"" << font << "\">";
+				}
 				else if (outputformat == FMT_RTF) {
 					*output << ": {\\f1 ";
 				}
@@ -456,7 +488,8 @@
 				maxverses--;
 			}
 		}
-
+		
+		
 		*output << "(";
 		*output << target->getName();
 		*output << ")\n";
@@ -466,6 +499,4 @@
 		}
 
 	}
-	delete parser;
-}
 

Modified: branches/sword-1-7-x/utilities/diatheke/corediatheke.h
===================================================================
--- branches/sword-1-7-x/utilities/diatheke/corediatheke.h	2014-04-17 04:35:02 UTC (rev 3188)
+++ branches/sword-1-7-x/utilities/diatheke/corediatheke.h	2014-04-17 05:00:28 UTC (rev 3189)
@@ -30,6 +30,7 @@
 
 #include "diathekemgr.h"
 #include <localemgr.h>
+#include <swlocale.h>
 
 #define QT_BIBLE 1
 #define QT_COMM 2




More information about the sword-cvs mailing list