aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-06 12:10:34 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-06 12:10:34 -0700
commita0a6759d930c081d95d0984b4ffdbd1a55cf4961 (patch)
treefae7a20798e7c909d4e8e18e61e968b2c1fc7287 /qt-ui
parent98dd127f9350ac04b1895a1a126ff23579784537 (diff)
downloadsubsurface-a0a6759d930c081d95d0984b4ffdbd1a55cf4961.tar.gz
User manual: show a localized version of the manual if it exists
So far we only have Spanish, but it always pays to plan ahead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/usermanual.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/usermanual.cpp b/qt-ui/usermanual.cpp
index 82691594c..3985b6cd4 100644
--- a/qt-ui/usermanual.cpp
+++ b/qt-ui/usermanual.cpp
@@ -1,10 +1,12 @@
#include <QDesktopServices>
#include <QShortcut>
+#include <QFile>
+#include <QDebug>
#include "usermanual.h"
#include "ui_usermanual.h"
-#include "../helpers.h"
+#include "helpers.h"
UserManual::UserManual(QWidget *parent) : QMainWindow(parent),
ui(new Ui::UserManual)
@@ -31,7 +33,15 @@ UserManual::UserManual(QWidget *parent) : QMainWindow(parent),
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath.size()) {
- QUrl url(searchPath.append("/user-manual.html"));
+ // look for localized versions of the manual first
+ QString lang = uiLanguage(NULL);
+ QString prefix = searchPath.append("/user-manual");
+ QFile manual(prefix + "_" + lang + ".html");
+ if (!manual.exists())
+ manual.setFileName(prefix + "_" + lang.left(2) + ".html");
+ if (!manual.exists())
+ manual.setFileName(prefix + ".html");
+ QUrl url(manual.fileName());
ui->webView->setUrl(url);
} else {
ui->webView->setHtml(tr("Cannot find the Subsurface manual"));