Feature: Showing units along with labels

Lakshman acrlakshman at gmail.com
Sun Mar 9 18:52:11 PDT 2014


Thank you Thiago for helpful suggestions.

On Sun, Mar 9, 2014 at 6:58 PM, Thiago Macieira <thiago at macieira.org> wrote:

> Em dom 09 mar 2014, às 08:26:36, Dirk Hohndel escreveu:
> > +               if (prefs.text_label_with_units) {
> > +
> ui.airTempLabel->setText(QApplication::translate("Ma
> > inTab", +
> &(*(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:
>
> Rule 1 of translated UI: never concatenate strings.
>
> Please do it like this:
>
> if (prefs.text_label_with_units) {
>         ui.airTempLabel->setText(QApplication::translate("MainTab", "Air
> temp
> [%1]").arg(getTempUnit()));
>         [...]
> } else {
>         [...]
> }
>
> Note I removed the useless 0 and QApplication::UnicodeUTF8 arguments.
> They're
> redundant in that position. You can add them so they code is similar to the
> else branch if you want.
>

I updated the patch as per the suggestions and hopefully this time it is
clean and satisfy the rules. I ignored the last 2 arguments in if
condition, to make code short in length.


>
> > Also, that whole painful conversion to std::string seems rather awkward
> > and unnecessary. Simply use QString.
>
> It's more than awkward and unnecessary. It's inefficient and downright
> wrong for
> any unit containing the degree symbol (°).
>

This mistake is corrected in the updated patch.


>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>


Thank you,
Lakshman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140309/a3f00ece/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Feature-to-show-units-with-labels.patch
Type: text/x-patch
Size: 4739 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140309/a3f00ece/attachment-0001.bin>


More information about the subsurface mailing list