summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/abouttab.cc31
-rw-r--r--plugingui/abouttab.h5
2 files changed, 27 insertions, 9 deletions
diff --git a/plugingui/abouttab.cc b/plugingui/abouttab.cc
index 7e330cb..8a8f737 100644
--- a/plugingui/abouttab.cc
+++ b/plugingui/abouttab.cc
@@ -27,9 +27,32 @@
#include "abouttab.h"
#include <version.h>
+#include <translation.h>
#include "utf8.h"
+namespace
+{
+std::string getLocalizedFile(const std::string& file)
+{
+ auto language = Translation::getISO639LanguageName();
+ std::string file_localized = file + "." + language;
+ GUI::Resource resource_localized{file_localized};
+ if(resource_localized.valid())
+ {
+ return resource_localized.data();
+ }
+
+ GUI::Resource resource{file};
+ if(resource.valid())
+ {
+ return resource.data();
+ }
+
+ return "";
+}
+}
+
namespace GUI
{
@@ -60,7 +83,7 @@ std::string AboutTab::getAboutText()
" About\n"
"=============\n"
"\n");
- about_text.append(about.data());
+ about_text.append(getLocalizedFile(":../ABOUT"));
// Version
about_text.append(
@@ -78,7 +101,7 @@ std::string AboutTab::getAboutText()
" Bugs\n"
"=============\n"
"\n");
- about_text.append(bugs.data());
+ about_text.append(getLocalizedFile(":../BUGS"));
// Authors
about_text.append(
@@ -87,7 +110,7 @@ std::string AboutTab::getAboutText()
" Authors\n"
"=============\n"
"\n");
- about_text.append(UTF8().toLatin1(authors.data()));
+ about_text.append(UTF8().toLatin1(getLocalizedFile(":../AUTHORS")));
// GPL
about_text.append(
@@ -96,7 +119,7 @@ std::string AboutTab::getAboutText()
" License\n"
"=============\n"
"\n");
- about_text.append(gpl.data());
+ about_text.append(getLocalizedFile(":../COPYING"));
return about_text;
}
diff --git a/plugingui/abouttab.h b/plugingui/abouttab.h
index eda23da..ed06b1d 100644
--- a/plugingui/abouttab.h
+++ b/plugingui/abouttab.h
@@ -49,11 +49,6 @@ private:
TextEdit text_edit{this};
int margin{10};
-
- Resource about{":../ABOUT"};
- Resource bugs{":../BUGS"};
- Resource authors{":../AUTHORS"};
- Resource gpl{":../COPYING"};
};
} // GUI::