diff --git a/plugins/woocommerce-admin/lib/client-assets.php b/plugins/woocommerce-admin/lib/client-assets.php index acb19e4d7c6..d8f7a440464 100644 --- a/plugins/woocommerce-admin/lib/client-assets.php +++ b/plugins/woocommerce-admin/lib/client-assets.php @@ -130,6 +130,8 @@ function format_order_statuses( $statuses ) { * Output the wcSettings global before printing any script tags. */ function wc_admin_print_script_settings() { + global $wp_locale; + // Add Tracks script to the DOM if tracking is opted in, and Jetpack is installed/activated. $tracking_enabled = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ); $tracking_script = ''; @@ -179,6 +181,10 @@ function wc_admin_print_script_settings() { 'siteTitle' => get_bloginfo( 'name' ), 'trackingEnabled' => $tracking_enabled, 'dataEndpoints' => array(), + 'l10n' => array( + 'userLocale' => get_user_locale(), + 'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ), + ), ); foreach ( $preload_data_endpoints as $key => $endpoint ) { diff --git a/plugins/woocommerce-admin/packages/date/src/index.js b/plugins/woocommerce-admin/packages/date/src/index.js index 8b071929d72..d526ea73b42 100644 --- a/plugins/woocommerce-admin/packages/date/src/index.js +++ b/plugins/woocommerce-admin/packages/date/src/index.js @@ -5,7 +5,7 @@ import moment from 'moment'; import { find } from 'lodash'; import { __ } from '@wordpress/i18n'; -import { __experimentalGetSettings, format as formatDate } from '@wordpress/date'; +import { format as formatDate } from '@wordpress/date'; const QUERY_DEFAULTS = { pageSize: 25, @@ -491,10 +491,8 @@ export function getDateFormatsForInterval( interval, ticks = 0 ) { * we can use that data and enhance it with additional translations */ export function loadLocaleData() { - const { date } = wcSettings; - const settings = __experimentalGetSettings(); - const userLocale = settings.l10n.locale; - const { weekdaysShort } = settings.l10n; + const { date, l10n } = wcSettings; + const { userLocale, weekdaysShort } = l10n; // Keep the default Momentjs English settings for any English if ( ! userLocale.match( /en_/ ) ) {