2 patched attached.

1) Fix broken translation in divelist

Fixes a broken translation in the divelist introduced in commit 45b1d0d73db6e21.
Now, the (.. dives) string on a trip line in the divelist is translated (again).

2) Add missing tr() implementations

One specific string did not translate. First, Dirk and I (via IRC) suspected a 
leading space was
the issue (see commit eccac1321f512d8). However, I found out that the problem 
was still there. A non
translated string "%1 shown", when applying a filter on the divelist, and 
looking at a trip
line. It shows always untranslated "%1 shown". Extracting to-be-translated 
strings from
the code, I found 2 errors: Class <classname> lacks Q_OBJECT macro.

This patch adds a missing tr() definition and implementation to 2 structs.

best,

--jan



>From 4f3b38d2a66963f2e64d5d17ead00a6e85134c86 Mon Sep 17 00:00:00 2001
From: Jan Mulder <[email protected]>
Date: Tue, 20 Oct 2015 14:36:53 +0200
Subject: [PATCH 2/2] [PATCH] Add missing tr() implementations

One specific string did not translate. First, Dirk and I (via IRC) suspected a leading space was
the issue (see commit eccac1321f512d8). However, I found out that the problem was still there. A non
translated string "%1 shown", when applying a filter on the divelist, and looking at a trip
line. It shows always untranslated "%1 shown". Extracting to-be-translated strings from
the code, I found 2 errors: Class <classname> lacks Q_OBJECT macro.

This patch adds a missing tr() definition and implementation to 2 structs.

Signed-off-by: Jan Mulder <[email protected]>
---
 qt-models/divetripmodel.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qt-models/divetripmodel.h b/qt-models/divetripmodel.h
index 63dc806..31cee96 100644
--- a/qt-models/divetripmodel.h
+++ b/qt-models/divetripmodel.h
@@ -5,6 +5,8 @@
 #include "dive.h"
 
 struct DiveItem : public TreeItem {
+	Q_DECLARE_TR_FUNCTIONS(TripItem)
+public:
 	enum Column {
 		NR,
 		DATE,
@@ -38,6 +40,8 @@ struct DiveItem : public TreeItem {
 };
 
 struct TripItem : public TreeItem {
+	Q_DECLARE_TR_FUNCTIONS(TripItem)
+public:
 	virtual QVariant data(int column, int role) const;
 	dive_trip_t *trip;
 };
-- 
2.6.1

>From 7456b1d3ae62cd9f26d99775cc69ddf6afcc126e Mon Sep 17 00:00:00 2001
From: Jan Mulder <[email protected]>
Date: Tue, 20 Oct 2015 14:18:27 +0200
Subject: [PATCH 1/2] [PATCH] Fix broken translation in divelist

Fixes a broken translation in the divelist introduced in commit 45b1d0d73db6e21.
Now, the (.. dives) string on a trip line in de divelist is translated (again).

Signed-off-by: Jan Mulder <[email protected]>
---
 qthelper.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/qthelper.cpp b/qthelper.cpp
index db0649b..7e4d64e 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -1069,12 +1069,12 @@ QString get_trip_date_string(timestamp_t when, int nr, bool getday)
 
 	if (nr != 1) {
 		if (getday) {
-			ret = localTime.date().toString(dateFormat).append(" (%1 dives)").arg(nr);
+			ret = localTime.date().toString(dateFormat) + " " + QObject::tr("(%1 dives)").arg(nr);
 		} else {
-			ret = localTime.date().toString("MMM yy").append(" (%1 dives)").arg(nr);
+			ret = localTime.date().toString("MMM yy") + " " + QObject::tr("(%1 dives)").arg(nr);
 		}
 	} else {
-		ret = localTime.date().toString(dateFormat).append(" (1 dive)");
+		ret = localTime.date().toString(dateFormat) + " " + QObject::tr("(1 dive)");
 	}
 	return ret;
 
-- 
2.6.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to