summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-18 23:05:10 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-19 00:03:33 +0300
commitf99ee017f2ac6b03a6bc6122cb78923a9b4f6a5f (patch)
treeb325f2fa7063581f3110184aa449d08c9fafbb02 /src/gui
parentac9594ec37a52c436b87a2d431e7df126592e4a5 (diff)
downloadmanaplus-f99ee017f2ac6b03a6bc6122cb78923a9b4f6a5f.tar.gz
manaplus-f99ee017f2ac6b03a6bc6122cb78923a9b4f6a5f.tar.bz2
manaplus-f99ee017f2ac6b03a6bc6122cb78923a9b4f6a5f.tar.xz
manaplus-f99ee017f2ac6b03a6bc6122cb78923a9b4f6a5f.zip
Add help po translation.
Combine help and client data translations.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/didyouknowwindow.cpp20
-rw-r--r--src/gui/helpwindow.cpp22
2 files changed, 11 insertions, 31 deletions
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index a6b89923e..a071e1ffc 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -39,6 +39,9 @@
#include "utils/gettext.h"
#include "utils/langs.h"
+#include "utils/translation/podict.h"
+#include "utils/translation/translationmanager.h"
+
#include "debug.h"
static const int minTip = 1;
@@ -129,26 +132,13 @@ void DidYouKnowWindow::loadFile(int num)
{
const std::string file = strprintf("tips/%d", num);
const std::vector<std::string> langs = getLang();
- ResourceManager *resman = ResourceManager::getInstance();
std::string helpPath = branding.getStringValue("helpPath");
if (helpPath.empty())
helpPath = paths.getStringValue("help");
std::vector<std::string> lines;
- if (!langs.empty())
- {
- std::string name = helpPath + langs[0] + "/" + file + ".txt";
- if (resman->exists(name))
- resman->loadTextFile(name, lines);
- if (lines.empty() && langs.size() > 1)
- {
- name = helpPath + langs[1] + "/" + file + ".txt";
- resman->loadTextFile(name, lines);
- }
- }
-
- if (lines.empty())
- resman->loadTextFile(helpPath + file + ".txt", lines);
+ TranslationManager::translateFile(helpPath + file + ".txt",
+ translator, lines);
for (unsigned int i = 0; i < lines.size(); ++i)
mBrowserBox->addRow(lines[i]);
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 5876667da..0a28855b9 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -22,6 +22,7 @@
#include "gui/helpwindow.h"
+#include "configuration.h"
#include "logger.h"
#include "gui/gui.h"
@@ -33,11 +34,13 @@
#include "gui/widgets/scrollarea.h"
#include "resources/resourcemanager.h"
-#include "configuration.h"
#include "utils/gettext.h"
#include "utils/langs.h"
+#include "utils/translation/podict.h"
+#include "utils/translation/translationmanager.h"
+
#include "debug.h"
HelpWindow::HelpWindow():
@@ -105,26 +108,13 @@ void HelpWindow::loadHelp(const std::string &helpFile)
void HelpWindow::loadFile(const std::string &file)
{
const std::vector<std::string> langs = getLang();
- ResourceManager *resman = ResourceManager::getInstance();
std::string helpPath = branding.getStringValue("helpPath");
if (helpPath.empty())
helpPath = paths.getStringValue("help");
std::vector<std::string> lines;
- if (!langs.empty())
- {
- std::string name = helpPath + langs[0] + "/" + file + ".txt";
- if (resman->exists(name))
- resman->loadTextFile(name, lines);
- if (lines.empty() && langs.size() > 1)
- {
- name = helpPath + langs[1] + "/" + file + ".txt";
- resman->loadTextFile(name, lines);
- }
- }
-
- if (lines.empty())
- resman->loadTextFile(helpPath + file + ".txt", lines);
+ TranslationManager::translateFile(helpPath + file + ".txt",
+ translator, lines);
for (unsigned int i = 0; i < lines.size(); ++i)
mBrowserBox->addRow(lines[i]);