equal
deleted
inserted
replaced
26 #include <QSettings> |
26 #include <QSettings> |
27 #include <QStringListModel> |
27 #include <QStringListModel> |
28 #include <QDate> |
28 #include <QDate> |
29 #include <QDesktopWidget> |
29 #include <QDesktopWidget> |
30 #include <QLabel> |
30 #include <QLabel> |
|
31 #include <QLibraryInfo> |
31 |
32 |
32 #include "hwform.h" |
33 #include "hwform.h" |
33 #include "hwconsts.h" |
34 #include "hwconsts.h" |
34 #include "newnetclient.h" |
35 #include "newnetclient.h" |
35 |
36 |
316 engine->mount(cfgdir->absolutePath() + "/Data"); |
317 engine->mount(cfgdir->absolutePath() + "/Data"); |
317 engine->mount(cfgdir->absolutePath()); |
318 engine->mount(cfgdir->absolutePath()); |
318 engine->setWriteDir(cfgdir->absolutePath()); |
319 engine->setWriteDir(cfgdir->absolutePath()); |
319 engine->mountPacks(); |
320 engine->mountPacks(); |
320 |
321 |
321 QTranslator Translator; |
322 QTranslator TranslatorHedgewars; |
|
323 QTranslator TranslatorQt; |
322 { |
324 { |
323 QSettings settings(DataManager::instance().settingsFileName(), QSettings::IniFormat); |
325 QSettings settings(DataManager::instance().settingsFileName(), QSettings::IniFormat); |
324 settings.setIniCodec("UTF-8"); |
326 settings.setIniCodec("UTF-8"); |
325 |
327 |
326 QString cc = settings.value("misc/locale", QString()).toString(); |
328 QString cc = settings.value("misc/locale", QString()).toString(); |
331 // Fallback to current input locale if "C" locale is returned |
333 // Fallback to current input locale if "C" locale is returned |
332 if(cc == "C") |
334 if(cc == "C") |
333 cc = HWApplication::keyboardInputLocale().name(); |
335 cc = HWApplication::keyboardInputLocale().name(); |
334 } |
336 } |
335 |
337 |
336 // load locale file into translator |
338 // Load locale files into translators |
337 if (!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc))) |
339 if (!TranslatorHedgewars.load(QString("physfs://Locale/hedgewars_%1").arg(cc))) |
338 qWarning("Failed to install translation (%s)", qPrintable(cc)); |
340 qWarning("Failed to install Hedgewars translation (%s)", qPrintable(cc)); |
339 app.installTranslator(&Translator); |
341 if (!TranslatorQt.load(QString("%1/qt_%2").arg(QLibraryInfo::location(QLibraryInfo::TranslationsPath), cc))) |
|
342 qWarning("Failed to install Qt translation (%s)", qPrintable(cc)); |
|
343 app.installTranslator(&TranslatorHedgewars); |
|
344 app.installTranslator(&TranslatorQt); |
340 app.setLayoutDirection(QLocale(cc).textDirection()); |
345 app.setLayoutDirection(QLocale(cc).textDirection()); |
341 } |
346 } |
342 |
347 |
343 #ifdef _WIN32 |
348 #ifdef _WIN32 |
344 // Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir) |
349 // Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir) |