[KFormat] Add human readable list displaying function
Needs ReviewPublic

Authored by safaalfulaij on Aug 10 2018, 3:52 PM.

Details

Reviewers
None
Group Reviewers
Frameworks
Summary

Add formatList() to convert QStringLists to human readable strings.
This makes it possible to display strings like "A, B, C and D" natively in
all languages.

Test Plan

Added a test

Diff Detail

Repository
R244 KCoreAddons
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1682
Build 1700: arc lint + arc unit
safaalfulaij created this revision.Aug 10 2018, 3:52 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 10 2018, 3:52 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
safaalfulaij requested review of this revision.Aug 10 2018, 3:52 PM

Tbh I don't fully understand the struct and find statments (just saw working similar code and edited-copy-pasted). I prefer if someone can continue this instead of me.

bruns added a subscriber: bruns.Aug 10 2018, 6:02 PM

You should start with
a) a use case
b) show it actually matches the needs of different languages.

For e.g. englisch and the most european languages, two different positions are sufficent. Also, the AndListType and the UnitListType are identical. What is missing is a format where no conjunction is used, i.e. all lists elements are joined using ', '

bruns added inline comments.Aug 10 2018, 6:08 PM
autotests/kformattest.cpp
396

Why testDate?

src/lib/util/kformat.h
287

No unrelated changes, please.

src/lib/util/kformatprivate.cpp
477

No unrelated changes, please.

Fix test
No unrelated changes

You should start with
a) a use case
b) show it actually matches the needs of different languages.

For e.g. englisch and the most european languages, two different positions are sufficent. Also, the AndListType and the UnitListType are identical. What is missing is a format where no conjunction is used, i.e. all lists elements are joined using ', '

a) Most of the uses I found is in PIM, where day names and people names are joined for a neat sentence. Maybe even email header renderer could use this. Other uses: KAlgebra and KTurtle. Maybe even KMyMoney with the print check function (representing the full text representation of the amount.)
Not a very strong use case, yes, but I thought this can be helpful.

b) I agree with this that most languages use 2 positions only. I prefered to do what Unicode is doing and provide all the three forms they provide, to be in the safe side.
And you can see in that document all the forms they have. I thought it will be an overkill to add them all. I've scanned most languages in Unicode and there isn't any difference between normal and shorter versions.

If you see that this could be useful, then great, let's develop it. Otherwise we can just ignore it till we find a good use case.

safaalfulaij retitled this revision from [KFormat] Add human readble list displaying function to [KFormat] Add human readable list displaying function.Aug 10 2018, 7:00 PM