wcm_lang_switch
wcm_lang_switch copied to clipboard
Sort languages according to user preferences
When there are many languages installed, the menu should be sorted like this:
- Last used before current selection
- Second last used
- And so on.
- Parse the Accept-Language header and order all matching available languages according to the preference expressed by its numerical value.
q=1
should be first,q=0.9
the next and so on.q=0
should be the last in the complete list. - Sort everything else alphabetically.
I'm not at home currently, and my laptop sucks for developing. I have a nice class for Accept-Header parsing at home that you could use for 4. Will send a pull request when I'm back.
Nice idea. Will try to get over some of the issues this weekend. Thanks :)
Just wanted to ask about the status of this enhancement.
status: forgotten :)
Where the hell is the +1 button when you need it ;)
What, you mean this? :+1:
Anyway, I think only remember 1-2 previous choices. If you're flicking between languages (in no particular order) its not helpful to have them all listed by 'last used'. So current at the top - then last used (1-2 languages)- then the rest sorted alphabetically.
Each section should be separated by a line to make the sorting more apparent. Perhaps even label the second section 'last used'?
We could build upon this idea: Maybe add a check and only move this in if someone got 5+ or 10+ language files installed? Or maybe we could add a capability check, so it only behaves like this for the admin/super-admin user as those will likely be the developer?
@toscho Status: Forgotten again :)
Anyway, do you still have the class laying around somewhere? I'd already be happy about a Gist to see what we are talking about.
See Mlp_Accept_Header_Parser
and Mlp_Language_Negotiation
. This could be adjusted. Maybe I should make thios more abstract in MultilingualPress too.