[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1808: If no translated help files exist for the current GUI langua (in trunk: . src/gui/help/browser)
Author: edmanm
Date: 2007-07-21 13:02:31 -0400 (Sat, 21 Jul 2007)
New Revision: 1808
Modified:
trunk/
trunk/src/gui/help/browser/helpbrowser.cpp
trunk/src/gui/help/browser/helpbrowser.h
Log:
r1953@adrastea: edmanm | 2007-07-21 12:52:12 -0400
If no translated help files exist for the current GUI language, then simply
default to English.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /vidalia/local/trunk [r1953] on 54b3572a-7227-0410-958f-53ecd705b71a
Modified: trunk/src/gui/help/browser/helpbrowser.cpp
===================================================================
--- trunk/src/gui/help/browser/helpbrowser.cpp 2007-07-19 17:58:09 UTC (rev 1807)
+++ trunk/src/gui/help/browser/helpbrowser.cpp 2007-07-21 17:02:31 UTC (rev 1808)
@@ -26,6 +26,7 @@
*/
#include <QDomDocument>
+#include <QDir>
#include <vidalia.h>
#include <gui/mainwindow.h>
@@ -96,13 +97,24 @@
connect(ui.btnSearch, SIGNAL(clicked()), this, SLOT(search()));
/* Load the help topics from XML */
- loadContentsFromXml(":/help/" + Vidalia::language() + "/contents.xml");
+ loadContentsFromXml(":/help/" + language() + "/contents.xml");
/* Show the first help topic in the tree */
ui.treeContents->setCurrentItem(ui.treeContents->topLevelItem(0));
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
}
+/** Returns the language in which help topics should appear, or English
+ * ("en") if no translated help files exist for the current GUI language. */
+QString
+HelpBrowser::language()
+{
+ QString lang = Vidalia::language();
+ if (!QDir(":/help/" + lang).exists())
+ lang = "en";
+ return lang;
+}
+
/** Load the contents of the help topics tree from the specified XML file. */
void
HelpBrowser::loadContentsFromXml(QString xmlFile)
@@ -185,7 +197,7 @@
QString
HelpBrowser::getResourcePath(const QDomElement &topicElement)
{
- QString link = Vidalia::language() + "/" + topicElement.attribute(ATTRIBUTE_TOPIC_HTML);
+ QString link = language() + "/" + topicElement.attribute(ATTRIBUTE_TOPIC_HTML);
if (topicElement.hasAttribute(ATTRIBUTE_TOPIC_SECTION)) {
link += "#" + topicElement.attribute(ATTRIBUTE_TOPIC_SECTION);
}
Modified: trunk/src/gui/help/browser/helpbrowser.h
===================================================================
--- trunk/src/gui/help/browser/helpbrowser.h 2007-07-19 17:58:09 UTC (rev 1807)
+++ trunk/src/gui/help/browser/helpbrowser.h 2007-07-21 17:02:31 UTC (rev 1808)
@@ -65,6 +65,9 @@
void searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
private:
+ /** Returns the language in which help topics should appear, or English
+ * ("en") if no translated help files exist for the current GUI language. */
+ QString language();
/** Load the contents of the help topics tree from the specified XML file. */
void loadContentsFromXml(QString xmlFile);
/** Load the contents of the help topics tree from the given DOM document. */