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 :-).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Found one more...

Gábor Hojtsy’s picture

Status: Needs review » Fixed

Fixed the second case in the patch to say <= 5 (it said <= 4), and committed that, thanks.

hass’s picture

Status: Fixed » Reviewed & tested by the community

No, 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),

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Hm, actually from the looks of the code, *two* additional language options are added, not one. Right?

hass’s picture

FileSize
5.33 KB

Yes, 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.

Gábor Hojtsy’s picture

Uh. 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?

hass’s picture

Well, 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.

Gábor Hojtsy’s picture

Status: Needs work » Fixed

OK, 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.

hijas’s picture

i want to set my languages in select box..... plz help... iam using arabic and english language

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.