Fix translations of $GenericName
ClosedPublic

Authored by meven on Fri, Nov 8, 3:10 PM.

Details

Summary

$GenericName was translated before being passed to KMoreToolsService::formatString,
causing translators to process "$GenericName - ..." in their language, in turn causing formatString not to replace the expected placeholder.

Test Plan

In another language than English:
Open Dolphin
Click on the free space progress bar
Menu appears

Before (with French) :
First entry begins with "$NomGénérique -..."

After:
First entry begins with "Statistiques d'utilisation des disques - ..."

Diff Detail

Repository
R304 KNewStuff
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
meven created this revision.Fri, Nov 8, 3:10 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFri, Nov 8, 3:10 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
meven requested review of this revision.Fri, Nov 8, 3:10 PM
meven edited the summary of this revision. (Show Details)
meven updated this revision to Diff 69453.Fri, Nov 8, 3:11 PM

Amend comment

aspotashev added a subscriber: aspotashev.EditedFri, Nov 8, 3:49 PM

I suggest a more flexible approach which allows translators to more around the "$GenericName" part inside their translation and change the " - " separator to anything more appropriate in their language:

i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current folder", "$GenericName")

(and so on for the other messages)

meven added a comment.Fri, Nov 8, 3:52 PM

I suggest a more flexible approach which allows translators to more around the "$GenericName" part inside their translation and change the " - " separator to anything more appropriate in their language:

i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current folder", "$GenericName")

(and so on for the other messages)

I like it better will do

In general, string concatenation that you suggested is a big red flag for me as a translator. Concatenation often creates an untranslatable word puzzle.

meven updated this revision to Diff 69461.Fri, Nov 8, 3:58 PM

Better translator-friendly implementation

LGTM but please wait for approval from a translator too.

ngraham accepted this revision.Fri, Nov 8, 4:17 PM
This revision is now accepted and ready to land.Fri, Nov 8, 4:17 PM
meven added a comment.Fri, Nov 8, 4:31 PM

@aspotashev Is it good for ?

aspotashev accepted this revision.Fri, Nov 8, 5:13 PM

LGTM since it fixes the issue.

A next step could be a clearer explaination of what $GenericName will be replaced with. Is it always replaced with Filelight's GenericName from its filelight.desktop file?

meven added a comment.Fri, Nov 8, 5:15 PM

LGTM since it fixes the issue.

A next step could be a clearer explaination of what $GenericName will be replaced with. Is it always replaced with Filelight's GenericName from its filelight.desktop file?

Yes, it uses KMoreToolsService::formatString to replace $GenericName with content from its desktop file.

This revision was automatically updated to reflect the committed changes.