Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
6d64268e
Commit
6d64268e
authored
Jul 21, 2012
by
Katherine Bailey
Browse files
Only use the LanguageManager for multilingual environments
parent
1cd28eb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/includes/bootstrap.inc
View file @
6d64268e
...
...
@@ -2641,7 +2641,6 @@ function get_t() {
function
drupal_language_initialize
()
{
if
(
language_multilingual
())
{
$types
=
language_types_get_all
();
include_once
DRUPAL_ROOT
.
'/core/includes/language.inc'
;
foreach
(
$types
as
$type
)
{
language_manager
(
$type
);
}
...
...
@@ -2662,19 +2661,28 @@ function drupal_language_initialize() {
*/
function
language_manager
(
$type
)
{
static
$default_language
;
static
$initiated
=
FALSE
;
// Whether the language_manager has been initiated.
// Keep track of whether the language_manager has been initiated.
static
$initiated
=
FALSE
;
// Keep track of whether we are in a multilingual environment.
static
$multilingual
=
FALSE
;
$languages
=
&
drupal_static
(
__FUNCTION__
,
array
());
if
(
$initiated
)
{
if
(
$multilingual
&&
$initiated
)
{
if
(
!
isset
(
$languages
[
$type
]))
{
$languages
[
$type
]
=
drupal_container
()
->
get
(
'language_manager'
)
->
getLanguage
(
$type
);
}
return
$languages
[
$type
];
}
if
(
drupal_container
()
->
has
(
'language_manager'
))
{
$initiated
=
TRUE
;
$languages
[
$type
]
=
drupal_container
()
->
get
(
'language_manager'
)
->
getLanguage
(
$type
);
return
$languages
[
$type
];
if
(
language_multilingual
())
{
$multilingual
=
TRUE
;
if
(
drupal_container
()
->
has
(
'language_manager'
))
{
include_once
DRUPAL_ROOT
.
'/core/includes/language.inc'
;
$initiated
=
TRUE
;
$languages
[
$type
]
=
drupal_container
()
->
get
(
'language_manager'
)
->
getLanguage
(
$type
);
return
$languages
[
$type
];
}
}
// If this is not a multilingual environment or we have not yet entered the
// request scope, just use the default language regardless of $type.
if
(
isset
(
$default_language
))
{
return
$default_language
;
}
...
...
core/includes/install.core.inc
View file @
6d64268e
...
...
@@ -275,7 +275,7 @@ function install_begin_request(&$install_state) {
include_once
DRUPAL_ROOT
.
'/core/includes/session.inc'
;
// Set up $language, so t() caller functions will still work.
drupal_language_initialize
();
//
drupal_language_initialize();
require_once
DRUPAL_ROOT
.
'/core/includes/ajax.inc'
;
// Override the module list with a minimal set of modules.
...
...
core/lib/Drupal/Core/Language/LanguageManager.php
View file @
6d64268e
...
...
@@ -21,13 +21,7 @@ public function __construct(Request $request = NULL) {
}
public
function
getLanguage
(
$type
)
{
if
(
language_multilingual
())
{
$language
=
language_types_initialize
(
$type
,
array
(
'request'
=>
$this
->
request
));
}
else
{
$language
=
language_default
();
}
$language
=
language_types_initialize
(
$type
,
array
(
'request'
=>
$this
->
request
));
return
$language
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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