From 54bad72272bd269ce6176a5f31be7a1849cf8b0a Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Tue, 23 May 2017 15:10:34 +0200 Subject: [PATCH] Add spanish translation --- flameshot.pro | 2 + src/capture/button.cpp | 78 +++---- src/capture/button.h | 7 +- src/infowindow.cpp | 4 +- src/main.cpp | 9 +- translation/Internationalization_es.ts | 302 +++++++++++++++++++++++++ 6 files changed, 357 insertions(+), 45 deletions(-) create mode 100644 translation/Internationalization_es.ts diff --git a/flameshot.pro b/flameshot.pro index 76e53fa0..cea6edcc 100644 --- a/flameshot.pro +++ b/flameshot.pro @@ -17,6 +17,8 @@ PKGCONFIG += x11 TARGET = flameshot TEMPLATE = app +TRANSLATIONS = translation/Internationalization_es.ts + # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the diff --git a/src/capture/button.cpp b/src/capture/button.cpp index 2c048695..809b3401 100644 --- a/src/capture/button.cpp +++ b/src/capture/button.cpp @@ -60,7 +60,7 @@ void Button::initButton() { setMouseTracking(true); setMask(QRegion(QRect(-1,-1,BUTTON_SIZE+2, BUTTON_SIZE+2), QRegion::Ellipse)); - setToolTip(typeTooltip[m_buttonType]); + setToolTip(getTypeTooltip(m_buttonType)); emergeAnimation = new QPropertyAnimation(this, "size", this); emergeAnimation->setEasingCurve(QEasingCurve::InOutQuad); @@ -211,54 +211,54 @@ size_t Button::getButtonBaseSize() { // returns Button::Type::last when the corresponding button is not found. Button::Type Button::getTypeByName(const QString s) { Button::Type res = Type::last; - for (auto it = typeName.begin(); it != typeName.end(); ++it ) - if (it->second == s) - res = it->first; + for (auto i: typeName.toStdMap()) + if (i.second == s) + res = i.first; return res; } QString Button::getTypeName(const Button::Type t) { - return typeName[t]; + return tr(typeName[t]); } QString Button::getTypeTooltip(const Button::Type t) { - return typeTooltip[t]; + return tr(typeTooltip[t]); } Button::typeData Button::typeTooltip = { - {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::Type::selectionIndicator, QT_TR_NOOP("Shows the dimensions of the selection (X Y)")}, + {Button::Type::mouseVisibility, QT_TR_NOOP("Sets the visibility of the mouse pointer")}, + {Button::Type::exit, QT_TR_NOOP("Leaves the capture screen")}, + {Button::Type::copy, QT_TR_NOOP("Copies the selecion into the clipboard")}, + {Button::Type::save, QT_TR_NOOP("Opens the save image window")}, + {Button::Type::pencil, QT_TR_NOOP("Sets the paint tool to a pencil")}, + {Button::Type::line, QT_TR_NOOP("Sets the paint tool to a line drawer")}, + {Button::Type::arrow, QT_TR_NOOP("Sets the paint tool to an arrow drawer")}, + {Button::Type::rectangle, QT_TR_NOOP("Sets the paint tool to a rectagle drawer")}, + {Button::Type::circle, QT_TR_NOOP("Sets the paint tool to a circle drawer")}, + {Button::Type::marker, QT_TR_NOOP("Sets the paint tool to a marker")}, + {Button::Type::text, QT_TR_NOOP("Sets the paint tool to a text creator")}, + {Button::Type::colorPicker, QT_TR_NOOP("Opens the color picker widget")}, + {Button::Type::undo, QT_TR_NOOP("Undo the last modification")}, + {Button::Type::imageUploader, QT_TR_NOOP("Upload the selection to Imgur")}, + {Button::Type::move, QT_TR_NOOP("Move the selection area")} +}; Button::typeData Button::typeName = { - {Button::Type::selectionIndicator, "Selection Size Indicator"}, - {Button::Type::mouseVisibility, "Mouse Visibility"}, - {Button::Type::exit, "Exit"}, - {Button::Type::copy, "Copy"}, - {Button::Type::save, "Save"}, - {Button::Type::pencil, "Pencil"}, - {Button::Type::line, "Line"}, - {Button::Type::arrow, "Arrow"}, - {Button::Type::rectangle, "Rectangle"}, - {Button::Type::circle, "Circle"}, - {Button::Type::marker, "Marker"}, - {Button::Type::text, "Text"}, - {Button::Type::colorPicker, "Color Picker"}, - {Button::Type::undo, "Undo"}, - {Button::Type::imageUploader, "Image Uploader"}, - {Button::Type::move, "Move"} + {Button::Type::selectionIndicator, QT_TR_NOOP("Selection Size Indicator")}, + {Button::Type::mouseVisibility, QT_TR_NOOP("Mouse Visibility")}, + {Button::Type::exit, QT_TR_NOOP("Exit")}, + {Button::Type::copy, QT_TR_NOOP("Copy")}, + {Button::Type::save, QT_TR_NOOP("Save")}, + {Button::Type::pencil, QT_TR_NOOP("Pencil")}, + {Button::Type::line, QT_TR_NOOP("Line")}, + {Button::Type::arrow, QT_TR_NOOP("Arrow")}, + {Button::Type::rectangle, QT_TR_NOOP("Rectangle")}, + {Button::Type::circle, QT_TR_NOOP("Circle")}, + {Button::Type::marker, QT_TR_NOOP("Marker")}, + {Button::Type::text, QT_TR_NOOP("Text")}, + {Button::Type::colorPicker, QT_TR_NOOP("Color Picker")}, + {Button::Type::undo, QT_TR_NOOP("Undo")}, + {Button::Type::imageUploader, QT_TR_NOOP("Image Uploader")}, + {Button::Type::move, QT_TR_NOOP("Move")} }; diff --git a/src/capture/button.h b/src/capture/button.h index fd83ce75..47b80f17 100644 --- a/src/capture/button.h +++ b/src/capture/button.h @@ -19,13 +19,14 @@ #define BUTTON_H #include -#include +#include class QWidget; class QPropertyAnimation; class Button : public QPushButton { Q_OBJECT + Q_ENUMS(Type) public: enum class Type { @@ -77,12 +78,12 @@ signals: private: Button(QWidget *parent = 0); - Type m_buttonType; + const Type m_buttonType; bool m_pressed; QPropertyAnimation *emergeAnimation; - typedef std::map typeData; + typedef QMap typeData; static typeData typeTooltip; static typeData typeName; diff --git a/src/infowindow.cpp b/src/infowindow.cpp index 240f7ff0..b63034be 100644 --- a/src/infowindow.cpp +++ b/src/infowindow.cpp @@ -32,9 +32,9 @@ InfoWindow::InfoWindow(QWidget *parent) : QWidget(parent) { setWindowTitle(tr("About")); layout = new QVBoxLayout(this); - layout->addWidget(new QLabel("Shortcuts", this)); + layout->addWidget(new QLabel(tr("Shortcuts"), this)); initInfoTable(); - layout->addWidget(new QLabel("License", this)); + layout->addWidget(new QLabel(tr("License"), this)); layout->addWidget(new QLabel("GPLv3+", this)); // inform about full screen capture when no selection diff --git a/src/main.cpp b/src/main.cpp index ff48f824..72ea1a5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,11 +16,18 @@ // along with Flameshot. If not, see . #include "controller.h" -#include #include "singleapplication.h" +#include +#include int main(int argc, char *argv[]) { + QTranslator translator; + translator.load(QLocale::system().language(), + "Internationalization", "_"); + SingleApplication app(argc, argv); + app.installTranslator(&translator); + app.setApplicationName("flameshot"); app.setOrganizationName("Dharkael"); diff --git a/translation/Internationalization_es.ts b/translation/Internationalization_es.ts new file mode 100644 index 00000000..09f429a4 --- /dev/null +++ b/translation/Internationalization_es.ts @@ -0,0 +1,302 @@ + + + + + Button + + + Shows the dimensions of the selection (X Y) + Muestra la dimensión de ls selección (X Y) + + + + Sets the visibility of the mouse pointer + Selecciona la visibilidad del puntero del ratón + + + + Leaves the capture screen + Cierra la pantalla de captura + + + + Copies the selecion into the clipboard + Copia la selección al portapapeles + + + + Opens the save image window + Abre la ventana de guardar imagen + + + + Sets the paint tool to a pencil + Establece el lápiz como herramienta de dibujo + + + + Sets the paint tool to a line drawer + Establece la línea como herramienta de dibujo + + + + Sets the paint tool to an arrow drawer + Establece la flecha como herramienta de dibujo + + + + Sets the paint tool to a rectagle drawer + Establece el rectángulo como herramienta de dibujo + + + + Sets the paint tool to a circle drawer + Establece el círculo como herramienta de dibujo + + + + Sets the paint tool to a marker + Establece el marcador como herramienta de dibujo + + + + Sets the paint tool to a text creator + Establece el texto como herramienta de dibujo + + + + Opens the color picker widget + Abre el selector de color + + + + Undo the last modification + Deshace la última modificación + + + + Upload the selection to Imgur + Sube la selección a Imgur + + + + Move the selection area + Mueve la selección + + + + Selection Size Indicator + Indicador de Tamaño de Selección + + + + Mouse Visibility + Visibilidad del Ratón + + + + Exit + Salir + + + + Copy + Copiar + + + + Save + Guardar + + + + Pencil + Lápiz + + + + Line + Línea + + + + Arrow + Flecha + + + + Rectangle + Rectángulo + + + + Circle + Círculo + + + + Marker + Marcador + + + + Text + Texto + + + + Color Picker + Selector de Color + + + + Undo + Deshacer + + + + Image Uploader + Subir Imagen + + + + Move + Mover Selección + + + + CaptureWidget + + + Uploading image... + Subiendo imagen... + + + + ConfigWindow + + + Configuration + Configuración + + + + UI color editor + Editor de color de interfaz + + + + Button selection + Selección de botones + + + + Controller + + + &Configuration + &Configuración + + + + &Information + &Información + + + + &Quit + &Salir + + + + InfoWindow + + + About + Información + + + + <b>Shortcuts</b> + <b>Atajos</b> + + + + <b>License</b> + <b>Licencia</b> + + + + Right Click + Click Derecho + + + + Move selection 1px + Mueve la selección 1px + + + + Resize selection 1px + Redimensiona la selección 1px + + + + Quit capture + Salir de la captura + + + + Copy to clipboard + Copiar al portapapeles + + + + Save selection as a file + Guarda la selección como un archivo + + + + Undo the last modification + Deshacer la última modificación + + + + Show color picker + Muestra el selector de color + + + + Key + Tecla + + + + Description + Descripción + + + + QObject + + + /screenshot + /captura + + + + Save As + Guardar Como + + + + Save Error + Error al Guardar + + + + The image could not be saved to "%1". + la imagen no pudo ser guardada en "%1". + + +