diff options
Diffstat (limited to 'Swift/QtUI/main.cpp')
-rw-r--r-- | Swift/QtUI/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index d02cce6..d734713 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -21,6 +21,7 @@ #include <SwifTools/Application/PlatformApplicationPathProvider.h> #include <SwifTools/CrashReporter.h> #include <stdlib.h> +#include <Swiften/Base/Path.h> #include "QtSwift.h" #include "QtTranslator.h" @@ -33,7 +34,9 @@ int main(int argc, char* argv[]) { Swift::CrashReporter crashReporter(applicationPathProvider.getDataDir() / "crashes"); +#if QT_VERSION < 0x050000 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); +#endif // Parse program options boost::program_options::options_description desc = Swift::QtSwift::getOptionsDescription(); @@ -62,21 +65,23 @@ int main(int argc, char* argv[]) { } // Translation +#if QT_VERSION < 0x050000 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); +#endif boost::filesystem::path someTranslationPath = applicationPathProvider.getResourcePath("/translations/swift_en.qm"); QTranslator qtTranslator; if (!someTranslationPath.empty()) { #if QT_VERSION >= 0x040800 if (vm.count("language") > 0) { - qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + P2QSTRING(vm["language"].as<std::string>()), someTranslationPath.parent_path().string().c_str()); + qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + P2QSTRING(vm["language"].as<std::string>()), P2QSTRING(Swift::pathToString(someTranslationPath.parent_path()))); } else { - qtTranslator.load(QLocale::system(), QString(SWIFT_APPLICATION_NAME).toLower(), "_", someTranslationPath.parent_path().string().c_str()); + qtTranslator.load(QLocale::system(), QString(SWIFT_APPLICATION_NAME).toLower(), "_", P2QSTRING(Swift::pathToString(someTranslationPath))); } #else //std::cout << "Loading " << std::string(QLocale::system().name().toUtf8()) << std::endl; - qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + QLocale::system().name(), someTranslationPath.parent_path().string().c_str()); + qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + QLocale::system().name(), P2QSTRING(Swift::pathToString(someTranslationPath))); #endif } app.installTranslator(&qtTranslator); |