Problem/Motivation
While trying to word the error message that is the result of incompatible configuration, @webchick said making the error message better is A Good Thing. But, that really it would be better to have the interface not allow picking wrong choices.
Steps to reproduce
- Install drupal (8.x head)
- Under Extend, install/enable module: Content Translation
- (optional, but makes sense to) Add another language, Under configuration, regional and languages, languages, add language, at admin/config/regional/language
- Edit the content type Article, at admin/structure/types/manage/article
- select the Language settings to see the dropdown and checkboxes
Beta phase evaluation
Issue category | Task because there is no bug. |
---|---|
Issue priority | Normal because it is isolated and not across systems. |
Unfrozen changes | NOT Unfrozen only changes. |
Prioritized changes | The main goal of this issue is usability. |
Disruption | NOT Disruptive for core/contributed and custom modules/themes because it will not require a BC break/deprecation/internal refactoring/widespread changes. |
Allowed in the drupal 8 beta because it is a prioritized change where the usability improvement has an impact greater than the disruption.
Proposed resolution
This needs discussion, but a start suggestion is to not allow choosing the system languages (only showing specific ones?) when translation is already enabled and the lang select is hidden.
Remaining tasks
- explicitly write down the combinations of flows that goes through when to hide what and what to allow to be selected
- maybe mark up an example of one of the flows
- get screenshots
- get ui review
- revisit proposed solution
- implement
- manually test
- write tests
- review code
- etc
User interface changes
This is a ui issue. See above.
API changes
No api changes anticipated.
Comment | File | Size | Author |
---|---|---|---|
#73 | 1834266-73.patch | 7.88 KB | rodrigoaguilera |
#71 | 1834266-71.patch | 7.84 KB | rpayanm |
Comments
Comment #1
plachWhile doing this ensure that it is still possibile to hide the language selector and enable translation if a valid default language is selected.
Comment #2
e0ipsoI have identified the following workflow:
Background:
Case 1:
A validation error forbids you to save the content type.
Case 2:
This case is exactly the same one as Case 1 but selecting - Not applicable - as the Default language.
Case 3:
This case is exactly the same one as Case 1 but checking Show language selector on create and edit pages. In this case the validation error does not exist and therefore the user can successfully save the content type.
Case 4:
This case is exactly the same one as Case 1 but selecting English (or any other active language) as the Default language. In this case the validation error does not exist and therefore the user can successfully save the content type.
Comment #3
e0ipsoAssigning to myself in the context of core menthoring (with xjm).
Writing a patch to test.
Comment #4
Gábor HojtsyThe cases explained look all good and correct.
Comment #5
Gábor HojtsyAlso, same interaction happens on the content language configuration screen (in regional and languages), although for all entities altogether.
Comment #6
e0ipsoI would want to test the same behavior when selecting a locked language, but I do not know what those are or how to get one. Any thoughts?
Comment #7
Gábor HojtsyNot specified and not applicable are the two locked (non-configurable, non-removable) languages in core. Contrib can add more, there is no UI for these which is the nature on the non-configurability. :)
Comment #8
e0ipsoThanks!
I was thinking on hiding 'und', 'mul' and 'zxx' from the select but if contrib can add locked languages of their own this means the list should be retrieved in an Ajax call where the locked property can be tested.
Another option could be testing the language name against the regexp /^- .* -$/ in the JS side. Can we rely on a regexp like that, won't we be missing locked languages or having false alarms?
Other options include changing the form structure or/and markup to identify these locked languages, I'm not taking those into account for now.
Comment #9
Gábor HojtsyWell, we could generate some more metadata alongside the select box for the JS to use. I personally believe dynamically removing items from the select box when you check another checkbox might be unexpected and especially without explanation pretty surprising.
Comment #10
e0ipsoThe following patch detects locked language in the frontend part using a regex (like the one #8).
The patch performs the detection for each select individually, taking into account different default values allowed per entity bundle.
The same behavior is applied in the vocabulary edit form & node type edit form.
Taking #9 into account, we could evolve this patch to provide a hidden list of locked languages within the form to detect locked languages more accurately (instead of the regular expresion).
Entity translation settings
Taxonomy settings 1
Taxonomy settings 2
Comment #11
e0ipsoChanging status.
Comment #12
Gábor HojtsyThe disappearing/appearing description looks interesting. Maybe we should reserve space for it in the form, so it does not make the form jump around when clicked. However, before going deeper into this, it would probably be best to get some usability feedback. Tagging for that, so Bojhan et. al. can take a look.
Comment #13
plachNot sure I interpreted the screenshots correctly but locked languages should be hidden only when the bundle is translatable and the language selector is not shown.
Comment #14
e0ipsoplach is right in #13. This behavior should only be triggered when the bundle is translatable.
Comment #15
plachImproved title
Comment #16
e0ipsoThe new patch takes into account the comments by plach in #13.
Screenshots are from node type edit form:
Enabled + hidden (should hide locked languages)
Enabled + shown (should not hide locked languages)
Disabled + shown (should not hide locked languages)
Disabled + hidden (should not hide locked languages)
Comment #17
e0ipsoI forgot to update the status … again :-P
Comment #18
e0ipsoSee contributor task doc on manual testing: http://drupal.org/node/1489010
Comment #19
jsbalseraRerolled patch
It seems to work as described in #16 in Linux with Google Chrome Version 25.0.1364.97
Not message and not hidden options:
Disabled + Hidden:
Disabled + Shown:
Enabled + Shown:
Hidden options and explanation
Comment #20
e0ipsoComment #21
e0ipsoUnassign while waiting for RTBC.
Comment #22
Gábor HojtsyIt looks a bit odd to have this description on the checkbox for showing the language selector. It talks about options in the language dropdown and therefore describes what happened to another field, not this one.
As per Drupal code style there needs to be an empty line after the first line.
Was this cross-checked to be always used as is - -?
Why are you using opacity to hide the element? Looks strange to me.
Also seems like if I had an option selected and that option vanished, I'm not alerted at all visually that my settings will largely change. At least if the process removed the option I had selected before, it should let me know with a yellow box appearing there or something IMHO. Now that given this adjustment the server side will not complain anymore.
Comment #23
e0ipsoRe-checked. It appears on:
This was done because of your suggestion in #12, but I agree that is better hiding and showing it.
I added a standard warning message if the selected language is changed and moved the description to the language dropdown.
Comment #24
e0ipsoComment #25
YesCT CreditAttribution: YesCT commentedon admin/config/regional/content-language
when checking the show language select, it changes the drop down for default language to show (not hide) the not specified and not applicable choices.
but when checking translatable (which has the effect of checking the show language select) the drop down values do not change. they need to also show (not hide) the choices.
Comment #26
e0ipsoEdit (posted twice by mistake)
Comment #27
e0ipso@YesCT according to plach on #13
As I see it, if the language selector is shown then the user will be forced to make a valid choice on content creation, and locked languages may be the default initial choice.
Is this assumption correct?
Comment #28
Bojhan CreditAttribution: Bojhan commentedWondering, could these messages be a little bit more friendlier. Less focused on the user, and more on the system needing something.
- "You default language has been changed. You need to show the language selector to use a locked language."
+ You default language has been changed. To use a locked language, the language selector needs to be shown"
Also not sure about having "Some" in a message, that is quite ambiguous.
Comment #29
e0ipsoChaged wording according to #28.
Comment #30
YesCT CreditAttribution: YesCT commentedjust some grammer, line length (must be 80 chars or less for comments), and newlines for comment standards.
I'll text next.
Comment #31
YesCT CreditAttribution: YesCT commentedReminder, when testing, this needs to be tested on admin/config/regional/content-language too.
This patch removes languages from the drop down of *all* the language dropdowns, not just the table that has translation enabled and not showing the lang selector.
So when saving that page, changes are saved for a bunch of types that it was not intended to change.
http://screencast.com/t/8Z5qzlocixvd
Comment #32
YesCT CreditAttribution: YesCT commentedThe "some" languages that are not shown are also known as locked in the code, but I dont think we should use that word in the UI. They are also known as system languages at some point.. and then we just listed all of them too: Not specified, Not applicable
the link to "Explanation of the language options is found on the languages list page."
goes to admin/config/regional/language
Which used to list the locked/system languages Not specified and Not applicable, but we decided that showing them there to reorder them was just unneeded. So they are not "explained" there.
"Some default language options are hidden if the language selector is not shown."
to:
"Not specified, Not applicable, default language options are hidden if the language selector is not shown."
That list can grow if contrib adds other locked languages.
Comment #33
YesCT CreditAttribution: YesCT commentedNote this didn't show for me while I was testing.
Anyway, it's not the default language that is changed... it the choices shown that are changed.
[edit: removed wrong code chunk]
Comment #34
e0ipsoI re-rolled the patch and improved the warning message.
@YesCT, please make sure you have one locked language selected when hiding language selector (or enabling translation) to make the warning message to appear.
Comment #35
e0ipsoComment #37
jsbalseraRe-rolled the patch and fixed a php error.
Comment #38
e0ipsoComment #39
jsbalseraAdding also the interdiff
Comment #40
jsbalseraSorry, I answered without noticing that e0ipso had already answered changing the status... so I changed the status by mistake. I change it again now.
Comment #41
YesCT CreditAttribution: YesCT commentedJust a few picky docs and coding standards things.
unrelated change. lets put this back. it will keep the patch smaller and easier to review.
Should be sentence (add a period at the end of each sentence.) Also, wrap them together (but limit to 80 chars).
----
also, good catch in #39.
Next: Go ahead and make a new patch with these changes and that one. (This might be a good novice task, to do just that bit of improvement.)
---
needs still someone to try it. (I'll do that next)
Also, someone who knows js to see if the approach is a good one, and do a review.
Comment #42
YesCT CreditAttribution: YesCT commentedI tried this in chrome, firefox, safari.. (all ok)
and IE via a trial to browserstack.com I noticed something strange there.
Seems like the red error message does not she when have a locked language and then pick to hide.
Also, the extra help text does not disappear when clicking the checkbox to show the language select.
this needs someone with IE to actually try it.
Usability question, should the red message go away, when things are ok (when the help text goes away)? It stays.
screenshots:
had locked language selected when unchecked show selector (hid selector)
just hid selector, lock languages are hidden, and the extra helptext shows great
firefox ok
safari ok
IE. Maybe needs work. Needs try in IE natively.
Comment #43
Gábor HojtsyComment #44
jair CreditAttribution: jair commentedComment #45
luismagr CreditAttribution: luismagr commentedRe-rolled the patch #37 and run tests
Comment #46
e0ipsoThere was a problem with the previous re-roll.
Should pass tests.
Comment #47
e0ipsoComment #48
tim.plunkettRemoving tags
Comment #49
YesCT CreditAttribution: YesCT commentedupdated issue summary with steps to reporduce
Comment #50
YesCT CreditAttribution: YesCT commentedadded adding a language to the steps to reproduce
Comment #51
eshta CreditAttribution: eshta commentedWorking on during a drupal mentoring session.
Comment #52
eshta CreditAttribution: eshta commentedRe-rolled patch to current Drupal 8 version.
Comment #54
eshta CreditAttribution: eshta commentedRe-rolled.
Comment #55
eshta CreditAttribution: eshta commentedComment #56
hpz CreditAttribution: hpz commentedI did tests on firefox:
When enabling translation with a locked language it works correctly and the message
is shown above correctly.
But the the message didn't disappear when enabling the language selector or when doing any changes. It would be nice if the message disappears again.
Further, I noticed, when setting e.g. Default language to 'Current Interface language' and uncheck the 'Show language selector', the Default language setting changes in my case to 'German'. Re-checking 'Show language selector' the Default language setting jumping to '- not applicable -'.
Comment #57
hpz CreditAttribution: hpz commentedJust did a test on IE:
the second note, 'Default Language' setting stays correctly when un-checking and re-checking the 'Show language selector' box. So okay with IE.
Comment #58
naveko CreditAttribution: naveko commentedThe patch in #54 doesn't apply.
I got an error notice when trying to save the content type 'article' with these settings:
- Default language: not specified
- Show language selector on create and edit pages: off
- Enable translation: on.
The error notice:
Notice: Undefined index: und in content_translation_language_configuration_element_validate() (line 847 of core/modules/content_translation/content_translation.module).
Comment #59
naveko CreditAttribution: naveko commentedUploading a new patch that applies to the current state of core.
Comment #60
heddnComment #62
rodrigoaguileraFix to pass tests by doing the correct attach
Comment #63
rodrigoaguileraadd interdiff for my last patch
Comment #65
jsbalsera62: drupal-allow-only-valid-choices-1834266.62.patch queued for re-testing.
Comment #66
jsbalseraComment #67
YesCT CreditAttribution: YesCT commenteddid https://www.drupal.org/contributor-tasks/update-allowed-beta
to evaluate https://www.drupal.org/contribute/core/beta-changes
Comment #68
YesCT CreditAttribution: YesCT commentedComment #69
rpayanmComment #70
YesCT CreditAttribution: YesCT commentedneeds reroll again.
Comment #71
rpayanmComment #73
rodrigoaguileraPatch rerolled and some linting.