Mercurial > hg > isophonics-drupal-site
comparison core/modules/language/src/ConfigurableLanguageManager.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
88 * @var bool | 88 * @var bool |
89 */ | 89 */ |
90 protected $initialized = FALSE; | 90 protected $initialized = FALSE; |
91 | 91 |
92 /** | 92 /** |
93 * Whether already in the process of language initialization. | 93 * Whether language types are in the process of language initialization. |
94 * | 94 * |
95 * @var bool | 95 * @var bool[] |
96 */ | 96 */ |
97 protected $initializing = FALSE; | 97 protected $initializing = []; |
98 | 98 |
99 /** | 99 /** |
100 * {@inheritdoc} | 100 * {@inheritdoc} |
101 */ | 101 */ |
102 public static function rebuildServices() { | 102 public static function rebuildServices() { |
211 if (!isset($this->negotiatedLanguages[$type])) { | 211 if (!isset($this->negotiatedLanguages[$type])) { |
212 // Ensure we have a valid value for this language type. | 212 // Ensure we have a valid value for this language type. |
213 $this->negotiatedLanguages[$type] = $this->getDefaultLanguage(); | 213 $this->negotiatedLanguages[$type] = $this->getDefaultLanguage(); |
214 | 214 |
215 if ($this->negotiator && $this->isMultilingual()) { | 215 if ($this->negotiator && $this->isMultilingual()) { |
216 if (!$this->initializing) { | 216 if (!isset($this->initializing[$type])) { |
217 $this->initializing = TRUE; | 217 $this->initializing[$type] = TRUE; |
218 $negotiation = $this->negotiator->initializeType($type); | 218 $negotiation = $this->negotiator->initializeType($type); |
219 $this->negotiatedLanguages[$type] = reset($negotiation); | 219 $this->negotiatedLanguages[$type] = reset($negotiation); |
220 $this->negotiatedMethods[$type] = key($negotiation); | 220 $this->negotiatedMethods[$type] = key($negotiation); |
221 $this->initializing = FALSE; | 221 unset($this->initializing[$type]); |
222 } | 222 } |
223 // If the current interface language needs to be retrieved during | 223 // If the current interface language needs to be retrieved during |
224 // initialization we return the system language. This way string | 224 // initialization we return the system language. This way string |
225 // translation calls happening during initialization will return the | 225 // translation calls happening during initialization will return the |
226 // original strings which can be translated by calling them again | 226 // original strings which can be translated by calling them again |