From d03e11f93880e5c2a77226e0858900fb0a28dd3d Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Wed, 18 Jan 2023 11:17:59 +0100 Subject: [PATCH] Use detected locale in localized strings [PREMIUM-215] --- .../js/src/automation/components/statistics/index.tsx | 3 ++- .../editor/components/sidebar/automation/index.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mailpoet/assets/js/src/automation/components/statistics/index.tsx b/mailpoet/assets/js/src/automation/components/statistics/index.tsx index 20de9008fe..4c0c1f6c8e 100644 --- a/mailpoet/assets/js/src/automation/components/statistics/index.tsx +++ b/mailpoet/assets/js/src/automation/components/statistics/index.tsx @@ -1,4 +1,5 @@ import { Fragment } from '@wordpress/element'; +import { locale } from '../../config'; type Item = { key: string; @@ -15,7 +16,7 @@ export function Statistics({ items, labelPosition = 'before', }: Props): JSX.Element { - const intl = new Intl.NumberFormat(); + const intl = new Intl.NumberFormat(locale.toString()); return (
{items.map((item, i) => ( diff --git a/mailpoet/assets/js/src/automation/editor/components/sidebar/automation/index.tsx b/mailpoet/assets/js/src/automation/editor/components/sidebar/automation/index.tsx index 32b583c43f..f92d3370a9 100644 --- a/mailpoet/assets/js/src/automation/editor/components/sidebar/automation/index.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/sidebar/automation/index.tsx @@ -3,6 +3,7 @@ import { useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { storeName } from '../../../store'; import { TrashButton } from '../../actions/trash-button'; +import { locale } from '../../../../config'; export function AutomationSidebar(): JSX.Element { const { automationData } = useSelect( @@ -23,7 +24,7 @@ export function AutomationSidebar(): JSX.Element { Date added{' '} {new Date(Date.parse(automationData.created_at)).toLocaleDateString( - undefined, + locale.toString(), dateOptions, )} @@ -31,13 +32,13 @@ export function AutomationSidebar(): JSX.Element { Activated{' '} {automationData.status === 'active' && new Date(Date.parse(automationData.updated_at)).toLocaleDateString( - undefined, + locale.toString(), dateOptions, )} {automationData.status !== 'active' && automationData.activated_at && new Date(Date.parse(automationData.activated_at)).toLocaleDateString( - undefined, + locale.toString(), dateOptions, )} {automationData.status !== 'active' && !automationData.activated_at && (