Display more readable tooltip text
ClosedPublic

Authored by andrewc on Jul 4 2018, 4:16 AM.

Details

Summary

Special case added for handling tooltip text when in summary page

Gets rid of the confusing "Files: 2 (100%)" and "Click to go up to parent directory"
Fixes the partition name and "Used"/"New" being concatenated without spacing in between

Diff Detail

Repository
R352 Filelight
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
andrewc created this revision.Jul 4 2018, 4:16 AM
Restricted Application added a subscriber: kde-utils-devel. ยท View Herald TranscriptJul 4 2018, 4:16 AM
andrewc requested review of this revision.Jul 4 2018, 4:16 AM
sitter added inline comments.Jul 4 2018, 8:45 AM
src/radialMap/widgetEvents.cpp
156

should be on the previous line

158

I would, for all strings, find them easier to read if they were

QString("%1\n%2: %3).arg(foo, bar, kitten)

instead of concatenations. It would also be easier to spot spacing problems when written that way.

@sandsmark might disagree though ^^

168

should be on the next line

170

should be on the previous line

sandsmark requested changes to this revision.Jul 16 2018, 11:14 AM

please fix what harald pointed out, otherwise it looks good.

src/radialMap/widgetEvents.cpp
158

doesn't matter much to me, I don't really disagree in this case. might make sense to make it translatable, I'm not sure if the way this is structured works in all languages.

This revision now requires changes to proceed.Jul 16 2018, 11:14 AM
andrewc updated this revision to Diff 38109.Jul 20 2018, 2:57 AM

I'm not sure if there is any need to localize these strings, so I'm using QString(QLatin1String("...")). if you think there is a need, I can replace them with i18n().

yeah, I prefer to use i18n() wherever possible, different languages have very different ways of structuring text and information. (and use i18nc() to explain to the translators the context)

andrewc updated this revision to Diff 38282.Jul 24 2018, 2:48 AM
sitter requested changes to this revision.Jul 24 2018, 9:21 AM

Well, that opened a can of worms ๐Ÿ˜’

src/radialMap/widgetEvents.cpp
157

I am pretty sure the context needs to explain what %1,2,3 are. It's not obvious from the string itself what the placeholders are. This applies to pretty much all the i18n strings in the diff.

175โ€“177

This isn't new code I think, but this needs to be something like

if (percent > 0) {
string += i18ncp("%1 is an amount of files", "File: %1", "Files: %1", files);
} else {
string += i18ncp("%1 is an amount of files", "File: %1 (%2%)", "Files: %1 (%2%)", files, percent);
}

in a right-to-left language the percent may well need to go on the left of the string, not the right.

I am also not sure a plural is called for here. Files: 1 seems perfectly acceptable to me. File: 1 on the other hand looks somewhat odd.
Perhaps it should be written as 1 File (3%) and 2 Files (4%)? I am somewhat indifferent other than File: 1 looking meh though.

This revision now requires changes to proceed.Jul 24 2018, 9:21 AM
andrewc updated this revision to Diff 38324.Jul 24 2018, 11:49 AM
andrewc retitled this revision from Display more readable tooltip text in summary page to Display more readable tooltip text.

Localization is hard :(

I put the used/free tooltips into separate cases, hopefully that will make the context for localization clearer.

I agree, 1 File looks better than Files: 1.

Getting there :)

src/radialMap/widgetEvents.cpp
190

You could probably move the \n out of the i18n call, and prepend it always. It doesn't need localization and it being not mid-string seems like something that can easily get lost when translating.

src/summaryWidget.cpp
148

Doesn't this undo some of the i18n in the original code?

andrewc added inline comments.Jul 26 2018, 12:05 PM
src/radialMap/widgetEvents.cpp
190

I agree, but wouldn't that mean the translators would have to re-translate this string? I wonder if it's worth it

src/summaryWidget.cpp
148

I moved the i18n to this part:

if (strcmp("used", m_focus->file()->name8Bit()) == 0) {
    string = i18nc("Tooltip of used space on the partition, %1 is path, %2 is size", "%1\nUsed: %2",..
} else if (strcmp("free", m_focus->file()->name8Bit()) == 0) {
    string = i18nc("Tooltip of free space on the partition, %1 is path, %2 is size", "%1\nFree: %2",..

My logic is the context will be less confusing to translators if they see used or free instead of another variable "%2".

sitter accepted this revision.Jul 26 2018, 12:11 PM

Looks good to land unless @sandsmark sees more issues.

src/radialMap/widgetEvents.cpp
190

Oh, it's a pre-existing string. Yeah, they'd have to re-translate. Nevermind changing this then.

src/summaryWidget.cpp
148

Ah, perfect.

sandsmark accepted this revision.Oct 7 2018, 12:22 PM

thought I acked this already, but phabricator confuses me

This revision is now accepted and ready to land.Oct 7 2018, 12:22 PM
This revision was automatically updated to reflect the committed changes.