The current form that generates the list of languages is quite a mess.
You would think that it's a form of '#type' => 'radios', but in fact each language is its own form of '#type' => 'radio'. The form callback then uses '#return_value' to get everything working.
The attached patch
1. changes the form to build a normal $options array and simply use a '#type' => 'radios',
2. sticks a asort() in the middle to make the list properly sorted. This is especially nice, because asort() is case-sensitive, so when using l10n_install, all those languages who don't have a proper name (xxx-lolspeak, etc...) show up last.

This is technically an API change, but in practice there's only one project that this could theoretically affect (l10n_install), but that doesn't currently alter the form.
Also Gábor Hojtsy approved this, over in #944390: Improve usability of language selector (l10n_install) issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler’s picture

FileSize
55.49 KB

And a screenshot showing that the usage of '#type' => 'radios' removes a lot of useless whitespace.

Gábor Hojtsy’s picture

Oh, looks like a much better default! Why is it needs work and not needs review?

tstoeckler’s picture

Status: Needs work » Needs review

That, I don't know :)

Bojhan’s picture

Sorry, but did you check the implications of this on the usability of all other forms? I mean, we can easily create this more usable, I agree - but not if it negatively impacts the readability of other forms.

Gábor Hojtsy’s picture

This is a PHP code change that only affect this single form. No other forms are affected in the installer or elsewhere. The patch merely changes from including the elements as 'radio' buttons one by one to include them as a group of 'radios' which required less PHP code and apparently displays tighter. See screenshot.

Bojhan’s picture

Strange, well RTBC from visual perspective then.

idflood’s picture

Status: Needs review » Needs work
FileSize
1.44 KB

I applied the patch and at first it looked exactly to what I was expecting.

But the "value" attribute for the inputs are wrong with this patch ( output "1", "2", ... instead of "en", "fr",... ). The problem comes from the "sort($options)". It replace the array keys, leading to wrong values. Using asort($options) fixes the issue.

The new patch only replace the sort function with an asort.

Gábor Hojtsy’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 966818-install-locale-form-7.patch, failed testing.

tstoeckler’s picture

Assigned: Unassigned » tstoeckler

Assigning this to me, so I don't forget. This simply needs a reroll, though, so if you're faster than me, feel free.

idflood’s picture

Here is a reroll of the patch in #7. I also created a d8 patch only to see it's exactly the same as d7.

tstoeckler’s picture

Assigned: tstoeckler » Unassigned

Looks good, will try it out later.

Gábor Hojtsy’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs work » Needs review

Ok, unfortunately needs to go to 8.x first. Since its the same, it should not be scary to anybody, right? :)

tstoeckler’s picture

+++ b/includes/install.core.inc
@@ -1236,19 +1236,23 @@ function install_select_locale(&$install_state) {
+      $name .= ' ' . st('(built-in)');

Not strictly related to this patch, but is this form of string concatenation compatible with RTL-languages?

Powered by Dreditor.

aschiwi’s picture

Definitely looks much nicer! The patch in #11 works for me (Drupal 8) and I have no problems installing in another language either.

valthebald’s picture

I'm not quite sure how to submit to retest patch that was ignored on the first run, so just re-upload patch sort_list_language-966818-11-d8.patch from #11

Status: Needs review » Needs work

The last submitted patch, sort_list_language-966818-16.patch, failed testing.

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-base

@valthebald: well, that will not apply to Drupal 8 anymore. Does this bug still relevant for Drupal 8? We have been reworking the language list in the installer various times in Drupal 8 :)

valthebald’s picture

Status: Needs work » Closed (works as designed)

@Gábor Hojtsy: I guess no, just wanted to ensure

Gábor Hojtsy’s picture

Status: Closed (works as designed) » Needs work

@valthebald: all I said is the patch does not apply to Drupal 8 not that all problems are not applicable to Drupal 8. I'm not sure Drupal 8 would apply any ordering different to the language code base alphabetical list, looking at the code. Also even if none apply to Drupal 8, Drupal 7 could still use a fix. So I'd not go as fast as closing this down outright.

tstoeckler’s picture

Status: Needs work » Closed (fixed)

This has since been fixed.

tstoeckler’s picture

Version: 8.x-dev » 7.x-dev
Status: Closed (fixed) » Needs work

Oops, didn't read #20 correctly. I guess this could go into Drupal 7.