Include Date component required settings in app-wide settings object instead of using experimental retrieval from @wordpress/date.
This commit is contained in:
parent
4d37bdc67c
commit
3285ac4980
|
@ -130,6 +130,8 @@ function format_order_statuses( $statuses ) {
|
||||||
* Output the wcSettings global before printing any script tags.
|
* Output the wcSettings global before printing any script tags.
|
||||||
*/
|
*/
|
||||||
function wc_admin_print_script_settings() {
|
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.
|
// 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_enabled = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' );
|
||||||
$tracking_script = '';
|
$tracking_script = '';
|
||||||
|
@ -179,6 +181,10 @@ function wc_admin_print_script_settings() {
|
||||||
'siteTitle' => get_bloginfo( 'name' ),
|
'siteTitle' => get_bloginfo( 'name' ),
|
||||||
'trackingEnabled' => $tracking_enabled,
|
'trackingEnabled' => $tracking_enabled,
|
||||||
'dataEndpoints' => array(),
|
'dataEndpoints' => array(),
|
||||||
|
'l10n' => array(
|
||||||
|
'userLocale' => get_user_locale(),
|
||||||
|
'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $preload_data_endpoints as $key => $endpoint ) {
|
foreach ( $preload_data_endpoints as $key => $endpoint ) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { find } from 'lodash';
|
import { find } from 'lodash';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { __experimentalGetSettings, format as formatDate } from '@wordpress/date';
|
import { format as formatDate } from '@wordpress/date';
|
||||||
|
|
||||||
const QUERY_DEFAULTS = {
|
const QUERY_DEFAULTS = {
|
||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
|
@ -491,10 +491,8 @@ export function getDateFormatsForInterval( interval, ticks = 0 ) {
|
||||||
* we can use that data and enhance it with additional translations
|
* we can use that data and enhance it with additional translations
|
||||||
*/
|
*/
|
||||||
export function loadLocaleData() {
|
export function loadLocaleData() {
|
||||||
const { date } = wcSettings;
|
const { date, l10n } = wcSettings;
|
||||||
const settings = __experimentalGetSettings();
|
const { userLocale, weekdaysShort } = l10n;
|
||||||
const userLocale = settings.l10n.locale;
|
|
||||||
const { weekdaysShort } = settings.l10n;
|
|
||||||
|
|
||||||
// Keep the default Momentjs English settings for any English
|
// Keep the default Momentjs English settings for any English
|
||||||
if ( ! userLocale.match( /en_/ ) ) {
|
if ( ! userLocale.match( /en_/ ) ) {
|
||||||
|
|
Loading…
Reference in New Issue