Problem/Motivation
When configuring language path prefixes, there may be only one empty path prefix, that of the site default language. The intention of this is to protect users from setting an empty prefix for something that would not end up being selected as a fallback in the negotiation, basically making that language inaccessible by path. However, we made the fallback language configurable, so that this would be the site default language is not necessarily true. So you may now end up with a configuration where you cannot change the fallback language and remove the prefix before going live unless you also modify the site default language, which is silly. That was the reason we separated the default and the fallback languages to begin with.
Proposed resolution
Either only validate that at most one path prefix may be empty or validate that that is for the fallback language configured in the negotiation (not the site default).
Remaining tasks
Agree on approach. Implement.
User interface changes
Limitation on which language may get an empty prefix may change depending on configuration.
API changes
Likely none.
Comment | File | Size | Author |
---|---|---|---|
#15 | 2411343-empty_language_prefix-15.patch | 4.99 KB | pcambra |
#15 | interdiff-2411343-7-15.txt | 3.54 KB | pcambra |
#7 | 2411343-empty_language_prefix-7.patch | 3.91 KB | pcambra |
Comments
Comment #1
andypostLanguage as entity could have prefix constraint
Comment #2
Gábor Hojtsy@andypost: can you elaborate on that? I don't understand.
Comment #3
andypostI mean language is entity with prefix field that can have constraints applied
So when language entity is validated a (LanguageDefaultConstraint) constrain may check that default language is changed so prefix should be not empty or any other logic.
Comment #4
Gábor HojtsyYeah IF the fallback language is still tied to the default language.
Comment #5
balagan CreditAttribution: balagan commentedIs it a duplicate of this? https://www.drupal.org/node/338055
Comment #6
Gábor HojtsyNo, its not.
Comment #7
pcambraLet's see if I'm in the right track
Comment #8
Gábor HojtsyLooks good. Some remarks.
. I think "Selected fallback language" is good wording here too.
The feedback message is not very clear. I think we can leave that, because the text looked for is descriptive enough.
If you are fixing the grammar here, then we need a dot at the end too :)
Comment #9
balagan CreditAttribution: balagan commentedThe wording is the same here that I mentioned to Gábor on IRC, which does not make sense for me (negotiation selected language). I know that now it maches the page title, but I really don't like it.
Comment #10
Gábor HojtsyYeah for this screen we may use "selected fallback language" or "selected negotiation fallback language" but TECHNICALLY it may be a negotiation provider invoked before the URL negotiation, in which case, its not the fallback. We assume its the fallback for the design of how we expect the URL negotiation to be used, but it may not be 100% true. That makes it hard to label it @balagan.
Comment #11
balagan CreditAttribution: balagan commentedI could do with "language selected by negotiation", or "negotiated language", my problem is the word order.
Comment #12
Gábor Hojtsy@balagan: no, those are not correct. The text refers to the language the site admin selected in the negotiation method named "Selected language". If you go to your detection and selection methods page, that has the "Selected language" option as the last one. This help text refers to the setting that the admin set there. If we want to be super specific then "The language configured for the "Selected language" negotiation method" is what this is about.
Comment #13
balagan CreditAttribution: balagan commentedI still feel using "negotiation selected language" is wrong. Can we use "'selected language' negotiation", and on the admin/config/regional/language/detection/selected page I would change the title from "Configure selection language negotiation" to "Configure selected language negotiation". I guess I will have to open another issue for that.
Comment #14
Gábor Hojtsy@balagan: your proposed names may or may not be good depending on the sentence you put them. Please do open an issue for the page title on that method, that needs fixing definitely.
Comment #15
pcambraLet's see if this wording works better.
Comment #16
Gábor HojtsyLooks good to me, thanks!
Comment #17
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed a0add30 and pushed to 8.0.x. Thanks!
Comment #19
Gábor HojtsyYay, this is a great improvement! Thanks @pcambra!
Comment #21
mpp CreditAttribution: mpp at AmeXio for District09 commentedThis issue allows to configure an empty path prefix but it's not working on Drupal 8.5.
See https://www.drupal.org/project/drupal/issues/2953640
The test seems to cover the validation part but not the actual rendering when the prefix is empty?
Comment #22
AnybodyI can confirm this problem like described in #21. We've been running into it with 8.5 now also. In our example the German language prefix is empts (/) while all other languages have a language prefix (EN: /en). If the browser language is english also the German sites with no language index return the English tests.
Interestingly the front page is a different case, it works correct.
Comment #23
AnybodySORRY this issue is closed. The follow-up can be found at #2953640: URL language detection with empty path prefix not working