use russian tr if current language is russian
authorSerge Ziryukin <ftrvxmtrx@gmail.com>
Tue, 13 Apr 2010 12:22:14 +0000 (15:22 +0300)
committerSerge Ziryukin <ftrvxmtrx@gmail.com>
Tue, 13 Apr 2010 12:22:14 +0000 (15:22 +0300)
colorflood/src/colorscheme.cpp
colorflood/src/field.cpp
colorflood/src/main.cpp
colorflood/src/window.cpp

index c7cd4be..62f0eea 100644 (file)
@@ -29,6 +29,7 @@ ColorScheme::ColorScheme ()
     s << QColor(0xff, 0xff, 0x00); // yellow
     s << QColor(0xff, 0x00, 0xff); // magenta
     s << QColor(0x80, 0x00, 0x80); // purple
     s << QColor(0xff, 0xff, 0x00); // yellow
     s << QColor(0xff, 0x00, 0xff); // magenta
     s << QColor(0x80, 0x00, 0x80); // purple
+    /*: default color scheme name */
     schemes << QPair<QString, QVector<QBrush> >(QObject::tr("Default"), s);
 
     s.clear();
     schemes << QPair<QString, QVector<QBrush> >(QObject::tr("Default"), s);
 
     s.clear();
@@ -38,6 +39,7 @@ ColorScheme::ColorScheme ()
     s << QBrush(QColor(0x99, 0x99, 0x99), Qt::SolidPattern);
     s << QBrush(QColor(0xcc, 0xcc, 0xcc), Qt::CrossPattern);
     s << QBrush(QColor(0xff, 0xff, 0xff), Qt::SolidPattern);
     s << QBrush(QColor(0x99, 0x99, 0x99), Qt::SolidPattern);
     s << QBrush(QColor(0xcc, 0xcc, 0xcc), Qt::CrossPattern);
     s << QBrush(QColor(0xff, 0xff, 0xff), Qt::SolidPattern);
+    /*: black-and-white color scheme name */
     schemes << QPair<QString, QVector<QBrush> >(QObject::tr("Black-and-white"), s);
 
     QSettings settings;
     schemes << QPair<QString, QVector<QBrush> >(QObject::tr("Black-and-white"), s);
 
     QSettings settings;
index 6348d8f..b6a9db4 100644 (file)
@@ -264,6 +264,7 @@ void Field::flood (int colorIndex)
         finished = true;
 
         QMessageBox box;
         finished = true;
 
         QMessageBox box;
+        /*: win message */
         box.setText(tr("You won!"));
         box.exec();
     }
         box.setText(tr("You won!"));
         box.exec();
     }
@@ -272,6 +273,7 @@ void Field::flood (int colorIndex)
         finished = true;
 
         QMessageBox box;
         finished = true;
 
         QMessageBox box;
+        /*: fail message */
         box.setText(tr("You lost!"));
         box.exec();
     }
         box.setText(tr("You lost!"));
         box.exec();
     }
index cb25b9d..f618cb0 100644 (file)
@@ -12,6 +12,8 @@
 */
 
 #include <QApplication>
 */
 
 #include <QApplication>
+#include <QLocale>
+#include <QTranslator>
 #include "window.hpp"
 
 /*
 #include "window.hpp"
 
 /*
@@ -26,6 +28,13 @@ int main (int argc, char **argv)
     QCoreApplication::setOrganizationName("ftrvxmtrx");
     QCoreApplication::setApplicationName("Color Flood");
 
     QCoreApplication::setOrganizationName("ftrvxmtrx");
     QCoreApplication::setApplicationName("Color Flood");
 
+    QTranslator translator;
+
+    if (QLocale::Russian == QLocale::system().language())
+        translator.load(":/colorflood.qm");
+
+    app.installTranslator(&translator);
+
     Window window;
     window.show();
 
     Window window;
     window.show();
 
index 15c2861..d76ec4a 100644 (file)
@@ -23,7 +23,7 @@
 Window::Window ()
     : QWidget()
 {
 Window::Window ()
     : QWidget()
 {
-    setWindowTitle(tr("Color Flood"));
+    setWindowTitle("Color Flood");
 
     setWindowState(windowState() | Qt::WindowFullScreen);
 
 
     setWindowState(windowState() | Qt::WindowFullScreen);
 
@@ -63,7 +63,8 @@ Window::Window ()
 
 void Window::updateTurns (int turns)
 {
 
 void Window::updateTurns (int turns)
 {
-    turnsLabel->setText(QString("%1/%2")
+    /*: number of turns */
+    turnsLabel->setText(tr("Turns: %1/%2")
                         .arg(turns)
                         .arg(field->getNumTurnsOfSize(field->getSize())));
 }
                         .arg(turns)
                         .arg(field->getNumTurnsOfSize(field->getSize())));
 }