Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
If there are more then 5 languages on a website the user fieldset "Language settings" in "user/x/edit" becomes a very big radio list. This patch changes the "radios" to a "select" if there are more then 5 languages defined.
This is the same way how i10_server/community works :-).
Comment | File | Size | Author |
---|---|---|---|
#5 | language_search_string.png | 5.33 KB | hass |
#1 | locale_select_gt_5_radios.patch | 1.51 KB | hass |
locale_select_gt_5_radios.patch | 679 bytes | hass | |
Comments
Comment #1
hass CreditAttribution: hass commentedFound one more...
Comment #2
Gábor HojtsyFixed the second case in the patch to say <= 5 (it said <= 4), and committed that, thanks.
Comment #3
hass CreditAttribution: hass commentedNo, this is wrong... in the second case the number 4 was correct. In the first - 5 is correct. With 4 - the English language is not in the language array and is added extra. Therefor your change cause now to show the select only if your site have 6 languages (including english)...
See here - this requires the number "4":
'#options' => array_merge(array('all' => t('All languages'), 'en' => t('English (provided by Drupal)')), $languages),
Comment #4
Gábor HojtsyHm, actually from the looks of the code, *two* additional language options are added, not one. Right?
Comment #5
hass CreditAttribution: hass commentedYes, but
$languages
contains an array of languages without'en' => t('English (provided by Drupal)'))
. Check it out :-). The patch switches to select box if you have 5 languages, what are 6 radios... 5 languages + 1 item with "all languages". i tried to switch after 5 languages to select box and not after 5 radio items. Looks better and is more consistent in UI.Comment #6
Gábor HojtsyUh. It does not contain English, and it adds one more, so that's why we should do <= 3 to have the same effect: dropdown if more then 5 options, right?
Comment #7
hass CreditAttribution: hass commentedWell, we could do this at 3, if we'd like to switch at 5 radio items, but i think we should only change to select if more then "5 languages" as we do in l10_server and on the user/x/edit form. I know it's an exception to the switch at 6 radio items, but i think this is more consistent not to sum up the "all language" item together with the 5 active languages... i leave this to you.
Comment #8
Gábor HojtsyOK, committed a fix to have this at 3 + 2 = 5 options (not 5 languages). BTW l10n_server does the switch after 3 languages already, so it is not a good reference :) Also, core should not adhere to contrib module practices, when it comes to consistency, and we can do better here.
Comment #9
hijas CreditAttribution: hijas commentedi want to set my languages in select box..... plz help... iam using arabic and english language
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.