From 79829f32441be520b96f26c5a689ab3f83e68890 Mon Sep 17 00:00:00 2001 From: Serge Ziryukin Date: Tue, 13 Apr 2010 15:22:14 +0300 Subject: [PATCH] use russian tr if current language is russian --- colorflood/src/colorscheme.cpp | 2 ++ colorflood/src/field.cpp | 2 ++ colorflood/src/main.cpp | 9 +++++++++ colorflood/src/window.cpp | 5 +++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/colorflood/src/colorscheme.cpp b/colorflood/src/colorscheme.cpp index c7cd4be..62f0eea 100644 --- a/colorflood/src/colorscheme.cpp +++ b/colorflood/src/colorscheme.cpp @@ -29,6 +29,7 @@ ColorScheme::ColorScheme () s << QColor(0xff, 0xff, 0x00); // yellow s << QColor(0xff, 0x00, 0xff); // magenta s << QColor(0x80, 0x00, 0x80); // purple + /*: default color scheme name */ schemes << QPair >(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); + /*: black-and-white color scheme name */ schemes << QPair >(QObject::tr("Black-and-white"), s); QSettings settings; diff --git a/colorflood/src/field.cpp b/colorflood/src/field.cpp index 6348d8f..b6a9db4 100644 --- a/colorflood/src/field.cpp +++ b/colorflood/src/field.cpp @@ -264,6 +264,7 @@ void Field::flood (int colorIndex) finished = true; QMessageBox box; + /*: win message */ box.setText(tr("You won!")); box.exec(); } @@ -272,6 +273,7 @@ void Field::flood (int colorIndex) finished = true; QMessageBox box; + /*: fail message */ box.setText(tr("You lost!")); box.exec(); } diff --git a/colorflood/src/main.cpp b/colorflood/src/main.cpp index cb25b9d..f618cb0 100644 --- a/colorflood/src/main.cpp +++ b/colorflood/src/main.cpp @@ -12,6 +12,8 @@ */ #include +#include +#include #include "window.hpp" /* @@ -26,6 +28,13 @@ int main (int argc, char **argv) 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(); diff --git a/colorflood/src/window.cpp b/colorflood/src/window.cpp index 15c2861..d76ec4a 100644 --- a/colorflood/src/window.cpp +++ b/colorflood/src/window.cpp @@ -23,7 +23,7 @@ Window::Window () : QWidget() { - setWindowTitle(tr("Color Flood")); + setWindowTitle("Color Flood"); setWindowState(windowState() | Qt::WindowFullScreen); @@ -63,7 +63,8 @@ Window::Window () 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()))); } -- 1.7.9.5