Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Sep 2014 at 14:47 UTC
Updated:
6 Oct 2014 at 11:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alexpottComment #3
alexpottFixed test - missed a conversion.
Comment #4
gábor hojtsySo the prior approach to set the site default language ensured that you can only set a default language for a valid language.
We need some ensurance that the site default language exists as a language on the site, so you cannot just set 'yy' as the default language and move on :)
If this is done on the config directly and not eg. a method on the language manager or the default language service which could check if the value is valid, then bad things may happen. Yeah I know still you could use the config API at the end, but if our default API is the config API, then it can go wrong in itself, no?
Yay for being able to remove this :)
Comment #5
alexpottRe #4
Also it is still impossible to delete the default language through the config entity API - we throw an exception.
Comment #6
gábor hojtsyI had a long IRC discussion with @alexpott about the pre-patch state encouraging you to have a language to set it default, ie. $language->set('default', TRUE); which "ensured" you had that language, while it is totally possible to set arbitrary language codes with the other API that is encouraged / spread by this patch, as in $config->set('langcode', $somelangcode); While it is true pre-patch we could have used the later API as well, post patch we can only use the later API.
I don't agree it is on the same level of fault tolerance merely for now having only the more free-form way to set a default language, but we did not agree with @alexpott and I don't care enough to argue about this more. His point in short is one could argue to that to set a language as default you should get the language from the language manager and set the system.site:langcode from that (direct quote).
So then this is as good as it will get. I agree with the other changes and that default is external to the language not internal, it is a system property rather a language property.
Comment #7
alexpott#5.1 was incorrect - actually it'll fallback to creating a default language out of thin air using something like
new Language(array('id' => 'FAKE'))- see DrupalKernel::compileContainer().@Gábor Hojtsy thanks for the review and rtbc.
I'm not against adding a method to ConfigurableLangaugeManagerInterface to set the default language - but in core we have no use cases - so would contrib? The config API has no validation event - it is the responsibility of the callers to validate and provide correct values - therefore it is the responsibility of whatever sets system.site:langcode to ensure that the value at that point is valid.
Comment #8
yesct commentedread through this. tiny nit (missing space to indent a line).
also added the one line descriptions on properties and the @params. (I agree that in cases like this, it is repetitive and a bit silly, but... well, we dont say "unless it is sillily repetitive in our standard. so...)
Should still be rtbc.
opened #2340517: add a method to ConfigurableLangaugeManagerInterface to set the default language [edit: took out a misunderstanding of mine.]
Comment #9
gábor hojtsyWrong capitalization
Comment #10
yesct commented:)
Comment #11
gábor hojtsyBack to RTBC then.
Comment #12
yesct commentedopps. sorry. the interdiff was right, but the patch not.
This should be better.
Comment #13
alexpottRerolled due to #2337847: The negotiated method_id does not need to be sorted on the Language or ConfigurableLanguage object.
Comment #14
catchAlways found this annoying. When you have a property on something that's mutually exclusive with other items in the set something is wrong.
Committed/pushed to 8.0.x, thanks!
Comment #16
gábor hojtsyThanks a lot!