elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
104 stars 36 forks source link

CategoryView: create a translated property to use with the label and … #418

Closed tintou closed 3 years ago

tintou commented 4 years ago

…properly sort the labels

The labels were previously only sorted relative to English

davidmhewitt commented 4 years ago

Hm, when I run wingpanel with LANGUAGE=de_DE.utf8 (or any other language) in master on 6.0, the labels are already sorted alphabetically. I don't see that there would be anything wrong with merging this. But I also can't find the problem that needs fixing...

davidmhewitt commented 4 years ago

Yeah, it looks like cat_name is already translated here, even before your change.

Where are you seeing the issue?

tintou commented 4 years ago

The labels are translated but can't possibly be sorted right as the "cat_name" property itself doesn't hold the translated label but the original one in English.

davidmhewitt commented 4 years ago

I'm running 6.0 daily and I'm testing by running wingpanel (applications menu from master, without your branch) with:

LANGUAGE=fr_FR.utf8 wingpanel
LANGUAGE=de_DE.utf8 wingpanel
LANGUAGE=it_IT.utf8 wingpanel

All are correctly translated and sorted.

I've added a warning (cat_name) to the code and see translated categories in the console, they're not english when I'm running with a LANGUAGE env var :man_shrugging:

tintou commented 4 years ago

@davidmhewitt you're running my code, that's not possible otherwise

davidmhewitt commented 4 years ago

Even with your code, warning (cat_name) should not change...

It doesn't make sense to me either, but cat_name is already translated before calling dgettext

tintou commented 4 years ago

No idea why it is not on my system though…

jeremypw commented 3 years ago

I can confirm that the categories are sorted correctly both when the language is set to English and French (using Switchboard, logging out and back in), setting either the user or the system language. This is on a VM that has never had this PR installed.

jeremypw commented 3 years ago

Looks like this has already been fixed in master - cat_name is translated when it is assigned now.

jeremypw commented 3 years ago

@tintou Can this be closed now?

tintou commented 3 years ago

Capture d'écran du 2020-12-10 11 42 33@2x I still don't get why it's not sorted properly here

jeremypw commented 3 years ago

@tintou That's strange - I see that it is the label that is translated in master now, not the cat_name. So do we need a translated_name property as well? Can we just sort on the label to ensure that the categories appear in order?

jeremypw commented 3 years ago

I think this can be merged as it does no harm and fixes things for @tintou and so may help others.