From ca2e3cd5c4407ab8f2036d7107525e3ee3ff1f88 Mon Sep 17 00:00:00 2001 From: Qiaoyong Zhong Date: Tue, 20 May 2014 16:36:07 +0800 Subject: [PATCH] avoided trying to load English translation file --- main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index ba58fe2..f44cf9d 100644 --- a/main.cpp +++ b/main.cpp @@ -20,15 +20,18 @@ int main(int argc, char *argv[]) locale = QLocale::system().name(); settings.setValue("language", locale); } - QString tsFile = "2048-qt_" + locale; QTranslator translator; - if (translator.load(tsFile, ":/ts")) { - qDebug() << "Successfully loaded " + tsFile; - } else { - qDebug() << "Failed to load " + tsFile; + if (! locale.startsWith("en")) { + QString tsFile = "2048-qt_" + locale; + + if (translator.load(tsFile, ":/ts")) { + qDebug() << "Successfully loaded " + tsFile; + app.installTranslator(&translator); + } else { + qDebug() << "Failed to load " + tsFile; + } } - app.installTranslator(&translator); QQmlApplicationEngine engine;