diff --git a/core/includes/common.inc b/core/includes/common.inc index 9489e03c1f7a0cf3643c898114c3e5ff00bd6eee..9ec0e8613093e8363c612e26b84a5297a2fd5c49 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2073,7 +2073,12 @@ function _drupal_add_js($data = NULL, $options = NULL) { ksort($current_query); $path['currentQuery'] = (object) $current_query; } - $javascript['settings']['data'][] = array('path' => $path); + $javascript['settings']['data'][] = array( + 'path' => $path, + 'locale' => array( + 'pluralDelimiter' => LOCALE_PLURAL_DELIMITER, + ), + ); } // All JavaScript settings are placed in the header of the page with // the library weight so that inline scripts appear afterwards. diff --git a/core/misc/drupal.js b/core/misc/drupal.js index b8c007725f41b834357bd2d429f87c58fad475f7..afac700069f41f2b5e15c0f1632a4f892c9b763b 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -364,7 +364,7 @@ if (window.jQuery) { args = args || {}; args['@count'] = count; - var pluralDelimiter = Drupal.locale.pluralDelimiter; + var pluralDelimiter = drupalSettings.locale.pluralDelimiter; // Determine the index of the plural form. var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] === 1) ? 0 : 1); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 72ff18375d83b74cdebc61b9cf7875f323718fd9..8d1e09d9ad46accfd943cde020da021a770386ac 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -1296,9 +1296,7 @@ function _locale_rebuild_js($langcode = NULL) { $data_hash = NULL; $data = $status = ''; if (!empty($translations)) { - $data = array( - 'pluralDelimiter: ' . Json::encode(LOCALE_PLURAL_DELIMITER), - ); + $data = array(); $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array(); if (!empty($locale_plurals[$language->id]['formula'])) {