summaryrefslogtreecommitdiff
path: root/utilities/diatheke/corediatheke.cpp
diff options
context:
space:
mode:
authorDaniel Glassey <wdg@debian.org>2015-09-07 11:14:57 +0100
committerDaniel Glassey <wdg@debian.org>2015-09-07 11:14:57 +0100
commit7b6c8b08e9d29332dcd0a1029e7421334bfb6f61 (patch)
treedc263ee8b6c923716a8e0fed64756b7af1238dc7 /utilities/diatheke/corediatheke.cpp
parent7a00574163029c0c2b649878c95d5acbd083564a (diff)
Imported Upstream version 1.7.3+dfsg
Diffstat (limited to 'utilities/diatheke/corediatheke.cpp')
-rw-r--r--utilities/diatheke/corediatheke.cpp90
1 files changed, 62 insertions, 28 deletions
diff --git a/utilities/diatheke/corediatheke.cpp b/utilities/diatheke/corediatheke.cpp
index 37f9448..6e05e7c 100644
--- a/utilities/diatheke/corediatheke.cpp
+++ b/utilities/diatheke/corediatheke.cpp
@@ -2,9 +2,9 @@
*
* corediatheke.cpp -
*
- * $Id: corediatheke.cpp 2931 2013-07-31 13:07:26Z scribe $
+ * $Id: corediatheke.cpp 3207 2014-05-01 02:48:10Z greg.hellings $
*
- * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2001-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -120,17 +120,28 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
ListKey listkey;
SectionMap::iterator sit;
ConfigEntMap::iterator eit;
-
SWModule *target;
+
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 +159,19 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
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,15 +338,17 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*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();
+ *output << (char*)target->getKeyText();
if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << ": <font face=\"";
- *output << font;
- *output << "\">";
+ *output << ": <span style=\"font:\"" << font << ";\""
+ << " lang=\"" << modlocale << "\">";
}
else if (outputformat == FMT_RTF) {
*output << ": {\\f1 ";
@@ -331,16 +357,14 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*output << ": ";
}
*output << text;
- if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << "</font>";
+ if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
+ *output << "</span>";
}
else if (outputformat == FMT_RTF) {
*output << "}";
}
- *output << "(";
- *output << target->getName();
- *output << ")\n";
+ *output << "(" << target->getName() << ")\n";
}
if (outputformat == FMT_RTF) {
@@ -371,7 +395,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*output << ";}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}}";
}
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 << "\"/>";
}
for (i = 0; i < listkey.getCount() && maxverses; i++) {
@@ -381,10 +406,14 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*parser = element->getUpperBound();
while (maxverses && *target->getKey() <= *parser) {
*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 << ">";
+ }
if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << ": <font face=\"";
- *output << font;
- *output << "\">";
+ *output << ": <span style=\"font:\"" << font << ";\"" << " lang=\"" << modlocale << "\">";
}
else if (outputformat == FMT_RTF) {
*output << ": {\\f1 ";
@@ -393,8 +422,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*output << ": ";
}
*output << target->renderText();
- if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << "</font>";
+ if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
+ *output << "</span>";
}
else if (outputformat == FMT_RTF) {
*output << "}";
@@ -420,10 +449,16 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
else {
target->setKey(*listkey.getElement(i));
*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 << ">";
+ }
+ }
+
if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << ": <font face=\"";
- *output << font;
- *output << "\">";
+ *output << ": <font face=\"" << font << "\">";
}
else if (outputformat == FMT_RTF) {
*output << ": {\\f1 ";
@@ -432,8 +467,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
*output << ": ";
}
*output << target->renderText();
- if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
- *output << "</font>";
+ if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) {
+ *output << "</span>";
}
else if (outputformat == FMT_RTF) {
*output << "}";
@@ -452,7 +487,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
maxverses--;
}
}
-
+
+
*output << "(";
*output << target->getName();
*output << ")\n";
@@ -462,6 +498,4 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI
}
}
- delete parser;
-}