mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Added translations for oracle; fix #293
Translations have been updated.
This commit is contained in:
parent
25747a0964
commit
f80e319900
23 changed files with 11395 additions and 8800 deletions
|
|
@ -1,11 +1,33 @@
|
|||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include <QIcon>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#include "main.h"
|
||||
#include "oraclewizard.h"
|
||||
#include "settingscache.h"
|
||||
|
||||
QTranslator *translator, *qtTranslator;
|
||||
SettingsCache *settingsCache;
|
||||
|
||||
const QString translationPrefix = "oracle";
|
||||
#ifdef TRANSLATION_PATH
|
||||
QString translationPath = TRANSLATION_PATH;
|
||||
#else
|
||||
QString translationPath = QString();
|
||||
#endif
|
||||
|
||||
void installNewTranslator()
|
||||
{
|
||||
QString lang = settingsCache->getLang();
|
||||
|
||||
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
qApp->installTranslator(qtTranslator);
|
||||
translator->load(translationPrefix + "_" + lang, translationPath);
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
|
@ -20,8 +42,20 @@ int main(int argc, char *argv[])
|
|||
// this can't be changed, as it influences the default savepath for cards.xml
|
||||
QCoreApplication::setApplicationName("Cockatrice");
|
||||
|
||||
if (translationPath.isEmpty()) {
|
||||
#ifdef Q_OS_MAC
|
||||
translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
#elif defined(Q_OS_WIN)
|
||||
translationPath = app.applicationDirPath() + "/translations";
|
||||
#endif
|
||||
}
|
||||
|
||||
settingsCache = new SettingsCache;
|
||||
|
||||
qtTranslator = new QTranslator;
|
||||
translator = new QTranslator;
|
||||
installNewTranslator();
|
||||
|
||||
OracleWizard wizard;
|
||||
|
||||
QIcon icon(":/resources/appicon.svg");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue