[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2357: Fall back to English if there is no translation for a linked (in vidalia/trunk: . src/vidalia/help/browser)



Author: edmanm
Date: 2008-02-24 23:10:43 -0500 (Sun, 24 Feb 2008)
New Revision: 2357

Modified:
   vidalia/trunk/
   vidalia/trunk/src/vidalia/help/browser/helptextbrowser.cpp
Log:
 r133@lysithea:  edmanm | 2008-02-24 23:10:36 -0500
 Fall back to English if there is no translation for a linked help topic in the
 current language.



Property changes on: vidalia/trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r133] on 90112fd6-a33b-4cea-8d39-48ff1d78625c

Modified: vidalia/trunk/src/vidalia/help/browser/helptextbrowser.cpp
===================================================================
--- vidalia/trunk/src/vidalia/help/browser/helptextbrowser.cpp	2008-02-24 11:34:45 UTC (rev 2356)
+++ vidalia/trunk/src/vidalia/help/browser/helptextbrowser.cpp	2008-02-25 04:10:43 UTC (rev 2357)
@@ -1,7 +1,8 @@
 /****************************************************************
  *  Vidalia is distributed under the following license:
  *
- *  Copyright (C) 2006,  Matt Edman, Justin Hipple
+ *  Copyright (C) 2006-2007,  Matt Edman, Justin Hipple
+ *  Copyright (C) 2008,  Matt Edman
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License
@@ -25,6 +26,7 @@
  * \brief Displays an HTML-based help document
  */
 
+#include <QDir>
 #include <QFile>
 #include <vidalia.h>
 
@@ -45,14 +47,14 @@
   if (type == QTextDocument::HtmlResource) {
     QString helpPath = ":/help/";
     
-#if QT_VERSION >= 0x040104
-    /* On Qt 4.1.4 or later, name.path() only includes the filename (not
-     * the language code) for pages accessed by clicking on a link in another
-     * page, so add it now if there isn't a path already. */
+    /* Fall back to English if there is no translation of the specified help
+     * page in the current language. */
     if (!name.path().contains("/")) {
-      helpPath += Vidalia::language() + "/";
-    } 
-#endif
+      QString language = Vidalia::language();
+      if (!QDir(":/help/" + language).exists())
+        language = "en";
+      helpPath += language + "/";
+    }
     
     QFile file(helpPath + name.path());
     if (!file.open(QIODevice::ReadOnly)) {