radioapp/radioapplication/src/main.cpp
changeset 14 63aabac4416d
parent 13 46974bebc798
child 16 f54ebcfc1b80
--- a/radioapp/radioapplication/src/main.cpp	Fri Mar 19 09:29:04 2010 +0200
+++ b/radioapp/radioapplication/src/main.cpp	Fri Apr 16 14:58:55 2010 +0300
@@ -15,9 +15,17 @@
 *
 */
 
+// System includes
+#include <QTranslator>
+#include <QLocale>
+#include <QFile>
+
+// User includes
 #include "radioapplication.h"
 #include "radiologger.h"
 
+static const QString TRANSLATIONS_PATH_FORMAT = "%1:/resource/qt/translations/";
+
 /*!
  * Runs the application
  */
@@ -27,7 +35,17 @@
 
     LOG_TIMESTAMP( "Tesla started" );
 
+    const QString localizedRadio = "fmradio_" + QLocale::system().name();
+    QString path = QString( TRANSLATIONS_PATH_FORMAT ).arg( "C" );  
+    if ( !QFile::exists( path + localizedRadio ) ) {
+        path = QString( TRANSLATIONS_PATH_FORMAT ).arg( "Z" );
+    }
+    
+    QTranslator translator;
+    translator.load( localizedRadio, path );
+   
     RadioApplication app( argc, argv );
+    app.installTranslator( &translator );
     int returnValue = app.exec();
 
     UNINSTALL_MESSAGE_HANDLER // Uninstalls the file tracer