Feature: Showing units along with labels

Dirk Hohndel dirk at hohndel.org
Sun Mar 9 08:26:36 PDT 2014


Hi Lakshman,

On Sun, 2014-03-09 at 03:13 -0500, Lakshman wrote:

> In an attempt to slightly enhance user experience, I tried to show
> units along with labels. This feature can be enabled or disabled as
> shown in the attached snapshots. Patch is also attached. Would be
> grateful for any sort of feedback on this.

I like the idea. I am not excited about the implementation.

+		if (prefs.text_label_with_units) {
+			ui.airTempLabel->setText(QApplication::translate("MainTab",
+						&(*(std::string("Air temp") +
+								" [" +
+								*(get_temp_unit().toStdString().rbegin()) +
+								"]").begin()),
+						0, QApplication::UnicodeUTF8));
+

this breaks translation - the strings are parsed by a tool in order to
be collected for translation - nowhere here is the final string
accessible to the tool, so when at run time the string is assembled, it
won't be found in the translation database. It's a much better idea to
concatenate two translated strings:

Also, that whole painful conversion to std::string seems rather awkward
and unnecessary. Simply use QString.

There are quite a few spots in the application where we assemble strings
that are to be presented to the user. Can you look at those and create a
revised patch that doesn't use std::string and doesn't break
translation?

Thanks

/D




More information about the subsurface mailing list