Skip to content

Commit

Permalink
Set correct translation context for classes without qobjec #186
Browse files Browse the repository at this point in the history
  • Loading branch information
DamirPorobic committed Sep 8, 2019
1 parent d94848a commit c2c69c6
Show file tree
Hide file tree
Showing 18 changed files with 362 additions and 189 deletions.
2 changes: 1 addition & 1 deletion src/gui/operations/AddWatermarkOperation.cpp
Expand Up @@ -40,7 +40,7 @@ void AddWatermarkOperation::execute()

void AddWatermarkOperation::NotifyAboutMissingWatermarkImage() const
{
MessageBoxHelper::ok(QObject::tr("Watermark Image Required"), QObject::tr("Please add a Watermark Image via Options > Settings > Annotator > Update"));
MessageBoxHelper::ok(QCoreApplication::translate("AddWatermarkOperation", "Watermark Image Required"), QCoreApplication::translate("AddWatermarkOperation", "Please add a Watermark Image via Options > Settings > Annotator > Update"));
}

QPointF AddWatermarkOperation::getPositionForWatermark(const QPixmap &image, const QSize &availableSpace) const
Expand Down
2 changes: 2 additions & 0 deletions src/gui/operations/AddWatermarkOperation.h
Expand Up @@ -20,6 +20,8 @@
#ifndef KSNIP_ADDWATERMARKOPERATION_H
#define KSNIP_ADDWATERMARKOPERATION_H

#include <QCoreApplication>

#include <random>

#include <kImageAnnotator/KImageAnnotator.h>
Expand Down
4 changes: 2 additions & 2 deletions src/gui/operations/SaveAsOperation.cpp
Expand Up @@ -31,8 +31,8 @@ bool SaveAsOperation::execute()
{
auto path = mSavePathProvider.savePath();

auto title = QObject::tr("Save As");
auto filter = QObject::tr("Images") + QStringLiteral(" (*.png *.gif *.jpg);;") + QObject::tr("All Files") + QStringLiteral("(*)");
auto title = QCoreApplication::translate("SaveAsOperation", "Save As");
auto filter = QCoreApplication::translate("SaveAsOperation", "Images") + QStringLiteral(" (*.png *.gif *.jpg);;") + QCoreApplication::translate("SaveAsOperation", "All Files") + QStringLiteral("(*)");
QFileDialog saveDialog(mParent, title, path, filter);
saveDialog.setAcceptMode(QFileDialog::AcceptSave);

Expand Down
2 changes: 2 additions & 0 deletions src/gui/operations/SaveAsOperation.h
Expand Up @@ -20,6 +20,8 @@
#ifndef KSNIP_SAVEASOPERATION_H
#define KSNIP_SAVEASOPERATION_H

#include <QCoreApplication>

#include "src/backend/config/KsnipConfig.h"
#include "src/backend/config/SavePathProvider.h"
#include "src/backend/ImageSaver.h"
Expand Down
4 changes: 2 additions & 2 deletions src/gui/operations/UpdateWatermarkOperation.cpp
Expand Up @@ -26,8 +26,8 @@ UpdateWatermarkOperation::UpdateWatermarkOperation(QWidget *parent)

bool UpdateWatermarkOperation::execute()
{
auto title = QObject::tr("Select Image");
auto filter = QObject::tr("Images") + QStringLiteral(" (*.png *.gif *.jpg);;") + QObject::tr("All Files") + QStringLiteral("(*)");
auto title = QCoreApplication::translate("UpdateWatermarkOperation", "Select Image");
auto filter = QCoreApplication::translate("UpdateWatermarkOperation", "Images") + QStringLiteral(" (*.png *.gif *.jpg);;") + QCoreApplication::translate("UpdateWatermarkOperation", "All Files") + QStringLiteral("(*)");
QFileDialog dialog(mParent, title, QString(), filter);
dialog.setAcceptMode(QFileDialog::AcceptOpen);

Expand Down
1 change: 1 addition & 0 deletions src/gui/operations/UpdateWatermarkOperation.h
Expand Up @@ -20,6 +20,7 @@
#ifndef KSNIP_UPDATEWATERMARKOPERATION_H
#define KSNIP_UPDATEWATERMARKOPERATION_H

#include <QCoreApplication>
#include <QFileDialog>

#include "src/backend/WatermarkImageLoader.h"
Expand Down
44 changes: 29 additions & 15 deletions translations/ksnip_de.ts
Expand Up @@ -81,6 +81,17 @@
<translation>Polnische Übersetzung</translation>
</message>
</context>
<context>
<name>AddWatermarkOperation</name>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AnnotationSettings</name>
<message>
Expand Down Expand Up @@ -633,10 +644,10 @@ Möchten Sie sie speichern?</translation>
</message>
</context>
<context>
<name>QObject</name>
<name>SaveAsOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
<source>Save As</source>
<translation type="unfinished">Speichern als</translation>
</message>
<message>
<source>Images</source>
Expand All @@ -646,18 +657,6 @@ Möchten Sie sie speichern?</translation>
<source>All Files</source>
<translation type="unfinished">Alle Dateien</translation>
</message>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save As</source>
<translation type="unfinished">Speichern als</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -690,4 +689,19 @@ Möchten Sie sie speichern?</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWatermarkOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Images</source>
<translation type="unfinished">Bilder</translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished">Alle Dateien</translation>
</message>
</context>
</TS>
44 changes: 29 additions & 15 deletions translations/ksnip_es.ts
Expand Up @@ -80,6 +80,17 @@
<translation>Traducción polaca</translation>
</message>
</context>
<context>
<name>AddWatermarkOperation</name>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AnnotationSettings</name>
<message>
Expand Down Expand Up @@ -629,10 +640,10 @@ Desea guardarla?</translation>
</message>
</context>
<context>
<name>QObject</name>
<name>SaveAsOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
<source>Save As</source>
<translation type="unfinished">Salvar como</translation>
</message>
<message>
<source>Images</source>
Expand All @@ -642,18 +653,6 @@ Desea guardarla?</translation>
<source>All Files</source>
<translation type="unfinished">Todos los archivos</translation>
</message>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save As</source>
<translation type="unfinished">Salvar como</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -686,4 +685,19 @@ Desea guardarla?</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWatermarkOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Images</source>
<translation type="unfinished">Imágenes</translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished">Todos los archivos</translation>
</message>
</context>
</TS>
44 changes: 29 additions & 15 deletions translations/ksnip_fr.ts
Expand Up @@ -80,6 +80,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AddWatermarkOperation</name>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AnnotationSettings</name>
<message>
Expand Down Expand Up @@ -614,10 +625,10 @@ Voulez-vous l&apos;enregistrer ?</translation>
</message>
</context>
<context>
<name>QObject</name>
<name>SaveAsOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
<source>Save As</source>
<translation type="unfinished">Enregistrer sous</translation>
</message>
<message>
<source>Images</source>
Expand All @@ -627,18 +638,6 @@ Voulez-vous l&apos;enregistrer ?</translation>
<source>All Files</source>
<translation type="unfinished">Tous les fichiers</translation>
</message>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save As</source>
<translation type="unfinished">Enregistrer sous</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -671,4 +670,19 @@ Voulez-vous l&apos;enregistrer ?</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWatermarkOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Images</source>
<translation type="unfinished">Image</translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished">Tous les fichiers</translation>
</message>
</context>
</TS>
44 changes: 29 additions & 15 deletions translations/ksnip_gl.ts
Expand Up @@ -80,6 +80,17 @@
<translation>Tradución ao polaco</translation>
</message>
</context>
<context>
<name>AddWatermarkOperation</name>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AnnotationSettings</name>
<message>
Expand Down Expand Up @@ -620,10 +631,10 @@ Quere gardala?</translation>
</message>
</context>
<context>
<name>QObject</name>
<name>SaveAsOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
<source>Save As</source>
<translation type="unfinished">Gardar como</translation>
</message>
<message>
<source>Images</source>
Expand All @@ -633,18 +644,6 @@ Quere gardala?</translation>
<source>All Files</source>
<translation type="unfinished">Todos os ficheiros</translation>
</message>
<message>
<source>Watermark Image Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please add a Watermark Image via Options &gt; Settings &gt; Annotator &gt; Update</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save As</source>
<translation type="unfinished">Gardar como</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -677,4 +676,19 @@ Quere gardala?</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UpdateWatermarkOperation</name>
<message>
<source>Select Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Images</source>
<translation type="unfinished">Imaxes</translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished">Todos os ficheiros</translation>
</message>
</context>
</TS>

0 comments on commit c2c69c6

Please sign in to comment.