diff --git a/core/modules/ckeditor/ckeditor.services.yml b/core/modules/ckeditor/ckeditor.services.yml index ebd0021..7e7d471 100644 --- a/core/modules/ckeditor/ckeditor.services.yml +++ b/core/modules/ckeditor/ckeditor.services.yml @@ -2,7 +2,7 @@ services: plugin.manager.ckeditor.plugin: class: Drupal\ckeditor\CKEditorPluginManager arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] - cache.ckeditor: + cache.ckeditor.languages: class: Drupal\Core\Cache\CacheBackendInterface tags: - { name: cache.bin } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index d6b1767..94fa1ac 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -275,7 +275,7 @@ public function getLangcodes() { // be expensive to calculate all the time. The cache is cleared on core // upgrades which is the only situation the CKEditor file listing should // change. - $langcode_cache = cache('ckeditor')->get('langcodes'); + $langcode_cache = cache('ckeditor.languages')->get('langcodes'); if (!empty($langcode_cache)) { $langcodes = $langcode_cache->data; } @@ -287,7 +287,7 @@ public function getLangcodes() { $langcode = basename($language_filename, '.js'); $langcodes[$langcode] = $langcode; } - cache('ckeditor')->set('langcodes', $langcodes); + cache('ckeditor.languages')->set('langcodes', $langcodes); } // Get language mapping if available to map to Drupal language codes. diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc index 8834812..dc69597 100644 --- a/core/modules/language/language.negotiation.inc +++ b/core/modules/language/language.negotiation.inc @@ -111,7 +111,13 @@ function language_from_browser($languages) { // so we multiply the qvalue by 1000 to avoid floating point comparisons. $langcode = strtolower($match[1]); $qvalue = isset($match[2]) ? (float) $match[2] : 1; - $browser_langcodes[$langcode] = (int) ($qvalue * 1000); + // Take the highest qvalue for this langcode. Although the request + // supposedly contains unique langcodes, our mapping possibly resolves + // to the same langcode for different qvalues. Keep the highest. + $browser_langcodes[$langcode] = max( + (int) ($qvalue * 1000), + (isset($browser_langcodes[$langcode]) ? $browser_langcodes[$langcode] : 0) + ); } }