Posted by Gábor Hojtsy on August 31, 2011 at 5:11pm
5 followers
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | language system |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | API clean-up, D8MI, language-base |
Issue Summary
The property argument of language_default() is at best laughable in these days of object chaining. It was really supposed to be a quick convenience feature, but its more like cruft that is already not used consistently in code (some places already use the proper object chaining syntax). We can just get rid of this and use it as a simpler API.
Parent issue
#1260488: META: Introduce real language APIs
Change records for this issue
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| modernize-language-default.patch | 5.21 KB | Idle | PASSED: [[SimpleTest]]: [MySQL] 32,913 pass(es). | View details |
Comments
#1
+++ b/includes/bootstrap.inc@@ -2558,14 +2558,13 @@ function language_list($field = 'language') {
+ return variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
In terms of "modernizing" can we split that out into separate lines, while we're at it?
Otherwise looks very good.
#2
Looks good?
#3
Awesome, thanks!
#4
+++ b/includes/bootstrap.inc@@ -2558,14 +2558,28 @@ function language_list($field = 'language') {
+function language_default() {
+ return variable_get(
+ 'language_default',
Hold on - we're storing a full object in a variable...?
Hope there's already a follow-up issue to clean that up.
20 days to next Drupal core point release.
#5
Committed to 8.x. Thanks!
#6
@sun: added #1272862: Clean up default language handling with some background info, your feedback is very welcome!
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
#9
Tagging for base language system.