Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
292
Merge Requests
292
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
60129882
Commit
60129882
authored
Jun 15, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2020249
by plach: Create Drupal::languageManager for improved DX.
parent
0e58a621
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
core/includes/bootstrap.inc
core/includes/bootstrap.inc
+3
-3
core/lib/Drupal.php
core/lib/Drupal.php
+10
-0
No files found.
core/includes/bootstrap.inc
View file @
60129882
...
...
@@ -2418,7 +2418,7 @@ function get_t() {
* Initializes all the defined language types and sets the default langcode.
*/
function
drupal_language_initialize
()
{
$language_manager
=
Drupal
::
service
(
'language_manager'
);
$language_manager
=
Drupal
::
languageManager
(
);
$language_manager
->
init
();
Drupal
::
translation
()
->
setDefaultLangcode
(
$language_manager
->
getLanguage
(
Language
::
TYPE_INTERFACE
)
->
langcode
);
}
...
...
@@ -2432,10 +2432,10 @@ function drupal_language_initialize() {
* The type of language object needed, e.g. Language::TYPE_INTERFACE.
*
* @deprecated as of Drupal 8.0. Use
* Drupal::
service('language_manager'
)->getLanguage($type).
* Drupal::
languageManager(
)->getLanguage($type).
*/
function
language
(
$type
)
{
return
Drupal
::
service
(
'language_manager'
)
->
getLanguage
(
$type
);
return
Drupal
::
languageManager
(
)
->
getLanguage
(
$type
);
}
/**
...
...
core/lib/Drupal.php
View file @
60129882
...
...
@@ -381,4 +381,14 @@ public static function translation() {
return
static
::
$container
->
get
(
'string_translation'
);
}
/**
* Returns the language manager service.
*
* @return \Drupal\Core\Language\LanguageManager
* The language manager.
*/
public
static
function
languageManager
()
{
return
static
::
$container
->
get
(
'language_manager'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment