Bug 476504 - "No other" pseudo name sorted wrong for language(s?) other than English
Summary: "No other" pseudo name sorted wrong for language(s?) other than English
Status: VERIFIED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (show other bugs)
Version: GIT master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-03 12:32 UTC by Andreas Schleth
Modified: 2023-11-06 20:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
KPA with English UI and some custom categories (Tokens are the "A+" icon) (107.04 KB, image/png)
2023-11-05 00:53 UTC, Andreas Schleth
Details
KPA with German UI and some custom categories (Tokens are the "A+" icon) (108.18 KB, image/png)
2023-11-05 01:03 UTC, Andreas Schleth
Details
Demo DB in English and German main window KPA v5.11.0-171-g314e3ca7 (83.87 KB, image/png)
2023-11-06 13:20 UTC, Andreas Schleth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schleth 2023-11-03 12:32:56 UTC
SUMMARY
This was checked with people names in the German and English localization (LANG=C): To select images of one person alone (no other persons in the image), the second selection is the pseudo name "No other". In English this is sorted on top of all the other names. In German the equivalent term is "keine weiteren". But this is sorted not on top and not even below "K" but below "N".

STEPS TO REPRODUCE
1. Have a KPA instance with German user interface. Most probably any language other than English will work as well.
2. Have a database with some images that are tagged with only one single person and others with tags for this person and others. The same would work for other categories than people.
3. From the home screen click the people category and select this person.
4a. From the home screen click on the people category again and select "No other" (en) / "keine weiteren" (de) ...
4b. Observe where in the list the respective term (pseudo name) is sorted.

OBSERVED RESULT
In the English UI "No others" is sorted on top of the list.
In the German UI "keine weiteren" is sorted below "N".

EXPECTED RESULT
The pseudo name should always be placed on top of the list.
[At least it should be sorted correctly below "K" and not "N".]

ADDITIONAL INFO
The same applies for the pseudo name "None" / "keine".

I did a "git bisect" search:
----
44d16fef5aac0568b38db571e9cba2c7e46bba9e is the first bad commit
commit 44d16fef5aac0568b38db571e9cba2c7e46bba9e
Author: Johannes Zarl-Zierl <johannes@zarl-zierl.at>
Date:   Sun Oct 8 14:57:01 2023 +0200

    Add natural sort order to Browser::TreeFilter.
    
    This adds locale-specific numerical sort order to the category browser
    pages.
----

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSuse Leap 15.5
KPA: v5.11.0-151-ge304108a
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Comment 1 Johannes Zarl-Zierl 2023-11-03 18:42:26 UTC
Hi Andreas,

Thanks for filing the bug report!
I can confirm that this issue is indeed caused by the newly introduced natural sort order feature...
Comment 2 Johannes Zarl-Zierl 2023-11-03 21:20:37 UTC
Git commit 7452e018361908b6f6b6146a8dd8de75461346ce by Johannes Zarl-Zierl.
Committed on 03/11/2023 at 21:53.
Pushed by johanneszarl into branch 'master'.

Fix sort order of "no other" and "none"

This fixes a regression introduced by
44d16fef5aac0568b38db571e9cba2c7e46bba9e (natural sort order), causing
"no other" or "none" and their localized versions to be sorted with the
rest of the list items when natual sort order was active.

M  +13   -6    Browser/AbstractCategoryModel.cpp
M  +8    -0    Browser/TreeFilter.cpp
M  +7    -6    Browser/enums.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/7452e018361908b6f6b6146a8dd8de75461346ce
Comment 3 Andreas Schleth 2023-11-04 13:53:42 UTC
I can confirm the fix. Thanks! 
Yeah!
Comment 4 Johannes Zarl-Zierl 2023-11-04 20:32:24 UTC
Thanks for checking!
Comment 5 Johannes Zarl-Zierl 2023-11-04 23:25:16 UTC
Git commit 7c4b288689dfcb4a1aaba556f8eea211eb0f1380 by Johannes Zarl-Zierl.
Committed on 05/11/2023 at 00:16.
Pushed by johanneszarl into branch 'master'.

Fix sort order on overview page.

Similar to bug #476504, with natural sort order, non-category items on
the browser overview page, like "Show Thumbnails" and others, would be
sorted alongside category items.
These entries should be sorted after categories.

Expanding on the ideal laid out in
7452e018361908b6f6b6146a8dd8de75461346ce, use a SortPriorityRole to sort
these entries in a stable and (hopefully) intuitive way:

1. Categories
2. search, geo position and exiv info (sorted according to localized name)
3. Untagged images
4. "Show Thumbnails"

M  +7    -2    Browser/AbstractCategoryModel.cpp
M  +22   -5    Browser/OverviewPage.cpp
M  +5    -5    Browser/TreeFilter.cpp
M  +1    -2    Browser/enums.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/7c4b288689dfcb4a1aaba556f8eea211eb0f1380
Comment 6 Andreas Schleth 2023-11-05 00:53:28 UTC
Created attachment 162868 [details]
KPA with English UI and some custom categories (Tokens are the "A+" icon)
Comment 7 Andreas Schleth 2023-11-05 01:03:15 UTC
Created attachment 162869 [details]
KPA with German UI and some custom categories (Tokens are the "A+" icon)

I think the very last commit did not work out as intended (?): 
As far as I understand (I may be wrong), the categories in the main window should have been sorted in a consistent way: Categories first and then the other items - preferably always in the same order
Notice the different positions of "Folder/Ordner" and "Tokens/Kürzel" in the two screenshots of the same DB with different LANG settings. 

KPA-Version: v5.11.0-166-g7c4b2886

Does this go back to the time when the default category names were translated? Most other of my databases have the term "Tokens" instead of "Kürzel" irrespective of LANG setting.
Comment 8 Johannes Zarl-Zierl 2023-11-05 20:13:24 UTC
(In reply to Andreas Schleth from comment #7)

> I think the very last commit did not work out as intended (?): 
> As far as I understand (I may be wrong), the categories in the main window
> should have been sorted in a consistent way: Categories first and then the
> other items - preferably always in the same order

Yes, that was the intention.

> Notice the different positions of "Folder/Ordner" and "Tokens/Kürzel" in the
> two screenshots of the same DB with different LANG settings. 

There's more going on here. "Darsteller" and "andere Personen" should be sorted entirely different in either locale.

> Does this go back to the time when the default category names were
> translated? Most other of my databases have the term "Tokens" instead of
> "Kürzel" irrespective of LANG setting.

I don't think so. There's nothing special anymore about those names...
Comment 9 Johannes Zarl-Zierl 2023-11-05 20:37:41 UTC
Git commit 152f0fd5a6063a61663a92754ff255345e3a8bab by Johannes Zarl-Zierl.
Committed on 05/11/2023 at 21:35.
Pushed by johanneszarl into branch 'master'.

Use alphabetic sort order for categories on overview page

Unit now, categories on the browser overview page would be sorted by
their "row" value. To have a more intuitive order, change this to
alphabetical sort order.

M  +6    -9    Browser/OverviewPage.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/152f0fd5a6063a61663a92754ff255345e3a8bab
Comment 10 Johannes Zarl-Zierl 2023-11-05 20:39:26 UTC
Ok, I found the culprit: items on the overview page are sorted by their "row" property and not their name. I don't even know for sure where the row value comes from, TBH.
I changed this now to use alphabetical sort order.

Is this result stable for you as well?
Comment 11 Andreas Schleth 2023-11-06 13:20:13 UTC
Created attachment 162898 [details]
Demo DB in English and German main window KPA v5.11.0-171-g314e3ca7

I think "Folder" and "Media Type" should be sorted with the non-category item at the end. Not necessarily in alphabetical order. 
Then, "Tokens" could be considered a non-category item as well, as it is always there without fail.

It might be sensible to sort the non-category items according to importance. (I usually navigate on autopilot by screen position without reading the sub titles.)

The single most important by far is "show thumbnails" - that should always be at the end to be easiest to find.
I often use "Folder", "Tokens" and "Search", rarely "Exif Info" and "Media Type", almost never "untagged" and "Geo Position" - others may have different preferences.
Comment 12 Johannes Zarl-Zierl 2023-11-06 20:04:53 UTC
Git commit e944761a8942382d199652772b3f6d2b1dd47fab by Johannes Zarl-Zierl.
Committed on 06/11/2023 at 21:01.
Pushed by johanneszarl into branch 'master'.

Try to improve overview page sort order

Old:
 1. Categories
 2. Geo Position, Exif Search, Regular Search (=items opening a special
    widget)
 3. Untagged Images
 4. Show Thumbnails

New:
 1. Regular Categories
 2. Special Categories (Tokens, Media Type, Folder)
 3. Geo Position, Exif Search, Regular Search (=items opening a special
    widget)
 4. Untagged Images
 5. Show Thumbnails

M  +15   -9    Browser/OverviewPage.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/e944761a8942382d199652772b3f6d2b1dd47fab
Comment 13 Johannes Zarl-Zierl 2023-11-06 20:13:25 UTC
(In reply to Andreas Schleth from comment #11)
> I think "Folder" and "Media Type" should be sorted with the non-category
> item at the end. Not necessarily in alphabetical order. 
> Then, "Tokens" could be considered a non-category item as well, as it is
> always there without fail.

Having them apart from the regular categories makes sense. I've implemented this now, more or less. To me, the specific ordering of Folder, Media Type, Tokens is not that important, as long as it's consistent (and everybody will have their own idea about the best ordering).

> It might be sensible to sort the non-category items according to importance.
> (I usually navigate on autopilot by screen position without reading the sub
> titles.)
> 
> The single most important by far is "show thumbnails" - that should always
> be at the end to be easiest to find.
> I often use "Folder", "Tokens" and "Search", rarely "Exif Info" and "Media
> Type", almost never "untagged" and "Geo Position" - others may have
> different preferences.

The last sentence is the key takeaway. One can't find the "right" ordering for everyone, apart from "Show Thumbnails" being the most important one. I did try to have the ordering make some sense, though:
1. regular category things
2. special category things
3. strange behaving things
4. things that switch to thumbnail view

In any case, sorting this differently from what it was (by chance) before upsets the muscle memory. So it makes sense to try to invest some time to do it well (and avoid having to change it again a year down the line).