Problem/Motivation

Setting that allows site administration to manage default language is located under Configuration > Regional and language > Regional settings. It was moved there originally to make it harder to change the site default (the radio button in the language list was too easy). At the time changing the site default had all kinds of wrong side effects. Several people found the placement of the setting confusing and cumbersome, and the original reasons do not apply anymore.

Proposed resolution

Option for managing default language should be moved back to Regional and language > Languages, as it was in D7.

This would be a rollback of the commit done for issue #1803638: Improve default language change process (ui and help text). The reason we can do this now is that the site default language is now assumed for almost no content or configuration anymore, everything has their own language assignment. So changing the site default language is not as dangerous as it used to be in Drupal 7 and therefore the reason to hide it from people does not stand anymore. We should not make people's life harder just because we can...

Remaining tasks

Review. Commit.

User interface changes

See Proposed resolution.

Original report by @Garrett Albright

The setting to change the default language for a site is currently at "Administration > Configuration > Regional and language >
Regional settings." This is illogical, as language is not a "regional setting" and language should be distinct from region. I was instead checking for this in "…Regional and language > Languages" for the setting, where it is in the D7 equivalent. Indeed, if you go to "…Regional and language > Languages > Detection and selection" and click the "Configure" button for "Selected language," you're prompted to change the site's default language - at "…Regional and language > Languages" (so the page you're linked to to change this setting is currently wrong).

I asked in #drupal-contribute for help when I couldn't find the setting, but it was late and nobody replied before I went to bed. I woke up with someone having left me a message via Druplicon asking me if I had figured out where the setting was yet, though - so it's not just me confused by this.

I assume someone at some point had a good reason for moving this setting to "Regional settings." What might it have been? Is it good enough to not move it back to the more logical place on "Languages?"

Comments

Garrett Albright’s picture

Issue tags: +user experience
LoMo’s picture

Issue tags: +D8MI

Just adding the D8MI tag, but also agree the the UX could be improved here, as someone who had not tested this in quite some time, I didn't find the setting were immediately apparent. Anyway, I looked at this issue (among others) to try to avoid creating a duplicate ticket for something I was observing.

Anyway, maybe "Language and Localization" would be a good heading for the Language/Translation/Locale -related stuff? I agree that "Regional and Language" is a bit counter-intuitive. I also agree that the Locale and Language are different enough they could be separated, but if under "Language and Localization", they would both start with "L" and there are close enough relationships and good reasons for showing these settings together (mixed feelings), e.g. for language negotiation rules, etc.

heddn’s picture

+1 on this. It should be added to the page where you add/manage languages for a site, and probably moved to the language module. I was taking part in the global training day yesterday in Nicaragua. There were three different tabs we had to visit to add, then change the default language from English to Spanish. BTW, the training was all done on beta3 of D8.

Garrett Albright’s picture

Version: 8.0.x-dev » 8.1.x-dev

The current situation is that the wrong link mentioned before has been fixed, but the menu is still in a dumb place.

I guess it's too late to fix this in D8.0, but maybe in D8.1 it could be on the "Languages" list as an item in the operations list - a "Set as default language" link for each that isn't the default language currently. What does everyone else think of an interface like that?

swentel’s picture

Version: 8.1.x-dev » 8.0.x-dev

UI's are not frozen afaik for 8.0.x-dev.

Been bitten a couple of times to set a default language, even a simple help text on the language overview page could be a helpful start.

Gábor Hojtsy’s picture

Issue tags: +language-base

We moved this setting because it was at a "too easy place". We also wanted to discourage changing the default language. There are options to change default content language per bundle and the fallback language also for the site, so the site default language has little relevance. Unless you keep the settings tied to it which is actually the default :)

See the discussion on #1803638: Improve default language change process (ui and help text). I think we can move it back now that we made so many things independent of it, but its hard to tell which contrib modules may have bad side effects with a site default language change. Core is mostly unshattered now in D8 (unlike in D7).

Gábor Hojtsy’s picture

Gábor Hojtsy’s picture

Title: Default language setting is in a strange place in admin interface » Default language setting is hard to find
Category: Task » Bug report
develCuy’s picture

develCuy’s picture

Issue tags: +SprintWeekend2015Queue

Removed SprintWeekend2015Queue by mistake.

karengrey’s picture

Status: Active » Needs work

Does this issue need work or review, it's not clear what is left to do here as per #7 comment.
Marking as Needs work for now.
Thanks

Gábor Hojtsy’s picture

I don't have anything against undoing #1803638: Improve default language change process (ui and help text), as said in #1803638-51: Improve default language change process (ui and help text), we landed this 2 years ago for reasons that may not be true anymore. Changing the site default language was much more dangerous back then. I think driving people to change the site fallback language for cases where that makes sense would make sense, but not sure this was the best idea. There were several concerns on the issue from Bojhan, tstoeckler, etc. If the change from 2 years ago did not hold well with actual users (which is what we are getting to now), then it makes sense to move back IMHO.

Gábor Hojtsy’s picture

Note that I wrote my tidbit about the move of this feature in mid 2013 and included this note at the bottom originally:

Changing the default language was moved out of this screen in https://drupal.org/node/1803638 but not everyone who used the system since then agreed this was a clear improvement. We may need to revisit this change and possibly roll it back based on further reviews and changes since then in core with language assignment.

Now edited to have a link to this issue at the end.

gobinathm’s picture

Summarizing the issue

pcambra’s picture

Status: Needs work » Needs review
FileSize
15.49 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 84,925 pass(es), 7 fail(s), and 0 exception(s). View

Getting back the default settings to the languages page.

Reviewing the patch in #1803638: Improve default language change process (ui and help text) I've found this piece of code:

@@ -740,6 +740,11 @@ function locale_form_language_admin_overview_form_alter(&$form, &$form_state) {
         '#markup' => t('not applicable'),
       );
     }
+    // #type = link doesn't work with #weight on table.
+    // reset and set it back after locale_statistics to get it at the right end.
+    $operations = $form['languages'][$langcode]['operations'];
+    unset($form['languages'][$langcode]['operations']);
+    $form['languages'][$langcode]['operations'] = $operations;
   }
 }

This is part of locale_form_language_admin_overview_form_alter, and looking to that function, I'd say we can move it to LanguageListTest, to the buildForm and buildRow methods, maybe in a followup?

Status: Needs review » Needs work

The last submitted patch, 15: 2153937-default_language_option-15.patch, failed testing.

pcambra’s picture

Status: Needs work » Needs review
FileSize
1.81 KB
16.54 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 84,889 pass(es). View

Missed a couple.

Gábor Hojtsy’s picture

The UI looks good. Drupal 7 has the radio button in a default column right before the operations and this one is right after the name. I think that is a minor question and I don't have a preference. The snippet you found in #15 is related to the placement of stats and operations and not connected to this issue.

@karengreen, @swentel, @Garrett Albright, @heddn, @Lomo: what do you think of this?

Updated the issue summary.

Gábor Hojtsy’s picture

FileSize
19.67 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 85,652 pass(es). View
3.33 KB

The help text also needed updating. I moved the help from the select box that the patch removed to the language page. Funnily enough, the "Selected language" negotiation settings help was never updated to point to the regional settings page to direct people where to set the site default. It still points to the language list, so it is now correct :D The general negotiation help was pointing to the regional settings page. Fixed that.

heddn’s picture

I'm good with the changes. The screenshots help a lot.

Gábor Hojtsy’s picture

Issue tags: +sprint
mon_franco’s picture

Assigned: Unassigned » mon_franco
Gábor Hojtsy’s picture

@mon_franco: let us know what you found!

mon_franco’s picture

Assigned: mon_franco » Unassigned

@gábor-hojtsy I found everything correct. I have checked all I could in the page "admin/config/regional/settings" and seems like is working perfectly. Let me know if you need more tests of this issue from my side :)

mon_franco’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes and improves UX, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 66b5cb9 and pushed to 8.0.x. Thanks!

  • alexpott committed 66b5cb9 on 8.0.x
    Issue #2153937 by Gábor Hojtsy, pcambra: Default language setting is...
Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

andypost’s picture

Filed follow-up for following #2420239: Default language setting form needs validation

  1. +++ b/core/modules/language/src/LanguageListBuilder.php
    @@ -126,12 +147,22 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +    // Save the default language.
    +    foreach ($form_state->getValue($this->entitiesKey) as $id => $value) {
    +      if (isset($this->entities[$id]) && ($id == $form_state->getValue('site_default_language'))) {
    +        \Drupal::configFactory()->getEditable('system.site')->set('langcode', $form_state->getValue('site_default_language'))->save();
    

    always saved?

  2. +++ b/core/modules/language/src/LanguageListBuilder.php
    @@ -126,12 +147,22 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +    // Force the redirection to the page with the language we have just
    +    // selected as default.
    +    $form_state->setRedirect('entity.configurable_language.collection', array(), array('language' => $this->entities[$form_state->getValue('site_default_language')]));
    

    should use $entity->urlInfo('collection', $options)

Wim Leers’s picture

Just wanted to say: excellent UI change, I just talked to Gábor about this problem in beta 6, then he tells me it's already solved by this issue :). Awesome work!

Status: Fixed » Closed (fixed)

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