From 74cea599d906926cd622f54a38fab208da691ec6 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Mon, 22 May 2017 23:15:05 +0200 Subject: [PATCH] Add string modifications for internationalization --- capture/button.cpp | 32 ++++++++++++++--------------- capture/capturewidget.cpp | 2 +- config/configwindow.cpp | 4 ++-- infowindow.cpp | 42 +++++++++++++++++++-------------------- infowindow.h | 3 +++ 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/capture/button.cpp b/capture/button.cpp index 5e7a04f0..47a69d5b 100644 --- a/capture/button.cpp +++ b/capture/button.cpp @@ -226,22 +226,22 @@ QString Button::getTypeTooltip(const Button::Type t) { } Button::typeData Button::typeTooltip = { - {Button::Type::selectionIndicator, "Shows the dimensions of the selection (X Y)"}, - {Button::Type::mouseVisibility, "Sets the visibility of the mouse pointer"}, - {Button::Type::exit, "Leaves the capture screen"}, - {Button::Type::copy, "Copies the selecion into the clipboard"}, - {Button::Type::save, "Opens the save image window"}, - {Button::Type::pencil, "Sets the paint tool to a pencil"}, - {Button::Type::line, "Sets the paint tool to a line drawer"}, - {Button::Type::arrow, "Sets the paint tool to an arrow drawer"}, - {Button::Type::rectangle, "Sets the paint tool to a rectagle drawer"}, - {Button::Type::circle, "Sets the paint tool to a circle drawer"}, - {Button::Type::marker, "Sets the paint tool to a marker"}, - {Button::Type::text, "Sets the paint tool to a text creator"}, - {Button::Type::colorPicker, "Opens the color picker widget"}, - {Button::Type::undo, "Undo the last modification"}, - {Button::Type::imageUploader, "Upload the selection to Imgur"}, - {Button::Type::move, "Move the selection area"} + {Button::Type::selectionIndicator, tr("Shows the dimensions of the selection (X Y)")}, + {Button::Type::mouseVisibility, tr("Sets the visibility of the mouse pointer")}, + {Button::Type::exit, tr("Leaves the capture screen")}, + {Button::Type::copy, tr("Copies the selecion into the clipboard")}, + {Button::Type::save, tr("Opens the save image window")}, + {Button::Type::pencil, tr("Sets the paint tool to a pencil")}, + {Button::Type::line, tr("Sets the paint tool to a line drawer")}, + {Button::Type::arrow, tr("Sets the paint tool to an arrow drawer")}, + {Button::Type::rectangle, tr("Sets the paint tool to a rectagle drawer")}, + {Button::Type::circle, tr("Sets the paint tool to a circle drawer")}, + {Button::Type::marker, tr("Sets the paint tool to a marker")}, + {Button::Type::text, tr("Sets the paint tool to a text creator")}, + {Button::Type::colorPicker, tr("Opens the color picker widget")}, + {Button::Type::undo, tr("Undo the last modification")}, + {Button::Type::imageUploader, tr("Upload the selection to Imgur")}, + {Button::Type::move, tr("Move the selection area")} }; Button::typeData Button::typeName = { diff --git a/capture/capturewidget.cpp b/capture/capturewidget.cpp index 44c773f3..96ce0b5f 100644 --- a/capture/capturewidget.cpp +++ b/capture/capturewidget.cpp @@ -380,7 +380,7 @@ void CaptureWidget::uploadScreenshot() { m_screenshot->uploadToImgur(am, getExtendedSelection()); } hide(); - Q_EMIT newMessage("Uploading image..."); + Q_EMIT newMessage(tr("Uploading image...")); } void CaptureWidget::undo() { diff --git a/config/configwindow.cpp b/config/configwindow.cpp index 2261ae9f..31b678e1 100644 --- a/config/configwindow.cpp +++ b/config/configwindow.cpp @@ -33,12 +33,12 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QWidget(parent){ QVBoxLayout *baseLayout = new QVBoxLayout(this); - QLabel *colorSelectionLabel = new QLabel("UI color editor", this); + QLabel *colorSelectionLabel = new QLabel(tr("UI color editor"), this); baseLayout->addWidget(colorSelectionLabel); baseLayout->addWidget(new UIcolorEditor(this)); - QLabel *buttonSelectLabel = new QLabel("Button selection", this); + QLabel *buttonSelectLabel = new QLabel(tr("Button selection"), this); baseLayout->addWidget(buttonSelectLabel); ButtonListView *m_buttonListView = new ButtonListView(this); diff --git a/infowindow.cpp b/infowindow.cpp index a4be1c80..240f7ff0 100644 --- a/infowindow.cpp +++ b/infowindow.cpp @@ -42,27 +42,27 @@ InfoWindow::InfoWindow(QWidget *parent) : QWidget(parent) { show(); } -namespace { - QVector keys = { - "←↓↑→", - "SHIFT + ←↓↑→", - "ESC", - "CTRL + C", - "CTRL + S", - "CTRL + Z", - "Right Click" - }; - QVector description = { - "Move selection 1px", - "Resize selection 1px", - "Quit capture", - "Copy to clipboard", - "Save selection as a file", - "Undo the last modification", - "Show color picker" - }; -} +QVector InfoWindow::keys = { + "←↓↑→", + "SHIFT + ←↓↑→", + "ESC", + "CTRL + C", + "CTRL + S", + "CTRL + Z", + tr("Right Click") +}; + +QVector InfoWindow::description = { + tr("Move selection 1px"), + tr("Resize selection 1px"), + tr("Quit capture"), + tr("Copy to clipboard"), + tr("Save selection as a file"), + tr("Undo the last modification"), + tr("Show color picker") +}; + void InfoWindow::initInfoTable() { QTableWidget *table = new QTableWidget(this); @@ -76,7 +76,7 @@ void InfoWindow::initInfoTable() { table->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // header creation QStringList names; - names << "Key" << "Description"; + names << tr("Key") << tr("Description"); table->setHorizontalHeaderLabels(names); //add content for (int i= 0; i < keys.size(); ++i){ diff --git a/infowindow.h b/infowindow.h index d174d715..3cceb90c 100644 --- a/infowindow.h +++ b/infowindow.h @@ -30,6 +30,9 @@ public: private: void initInfoTable(); QVBoxLayout *layout; + + static QVector keys; + static QVector description; }; #endif // INFOWINDOW_H