From baa036eb195fddcc63d453c9fa52df62e12313ae Mon Sep 17 00:00:00 2001 From: Nawfal Ahmed <111358247+NawfalAhmed@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:11:36 +0500 Subject: [PATCH] fix: fix unmarked translations (#306) --- .../OrdersAndSubscriptionsPage.jsx | 15 ++++++++------- .../OrdersAndSubscriptionsPage.messages.js | 11 +++++++++++ src/subscriptions/ManageSubscriptionsPage.jsx | 18 +++++++----------- .../ManageSubscriptionsPage.messages.js | 17 +++++++++++++++++ 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 src/orders-and-subscriptions/OrdersAndSubscriptionsPage.messages.js create mode 100644 src/subscriptions/ManageSubscriptionsPage.messages.js diff --git a/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.jsx b/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.jsx index 5bc24a26..cc2ada04 100644 --- a/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.jsx +++ b/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.jsx @@ -6,10 +6,15 @@ import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; import { BasicAlert, PageLoading } from '../components'; -import Subscriptions, { fetchSubscriptions } from '../subscriptions'; import OrderHistory, { fetchOrders } from '../order-history'; +import Subscriptions, { fetchSubscriptions } from '../subscriptions'; -import { errorSelector, loadingSelector, showSubscriptionSelector } from './selectors'; +import { + errorSelector, + loadingSelector, + showSubscriptionSelector, +} from './selectors'; +import messages from './OrdersAndSubscriptionsPage.messages'; const OrdersAndSubscriptionsPage = () => { const { formatMessage } = useIntl(); @@ -38,11 +43,7 @@ const OrdersAndSubscriptionsPage = () => { const renderLoading = () => ( <PageLoading - srMessage={formatMessage({ - id: 'ecommerce.order.history.loading', - defaultMessage: 'Loading orders and subscriptions...', - description: 'Message when orders and subscriptions page is loading.', - })} + srMessage={formatMessage(messages['ecommerce.order.history.loading'])} /> ); diff --git a/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.messages.js b/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.messages.js new file mode 100644 index 00000000..c9eb2694 --- /dev/null +++ b/src/orders-and-subscriptions/OrdersAndSubscriptionsPage.messages.js @@ -0,0 +1,11 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; + +const messages = defineMessages({ + 'ecommerce.order.history.loading': { + id: 'ecommerce.order.history.loading', + defaultMessage: 'Loading orders and subscriptions...', + description: 'Message when orders and subscriptions page is loading.', + }, +}); + +export default messages; diff --git a/src/subscriptions/ManageSubscriptionsPage.jsx b/src/subscriptions/ManageSubscriptionsPage.jsx index d06a1b9e..858684a7 100644 --- a/src/subscriptions/ManageSubscriptionsPage.jsx +++ b/src/subscriptions/ManageSubscriptionsPage.jsx @@ -7,6 +7,7 @@ import { PageLoading, SupportLink } from '../components'; import { fetchStripeCustomerPortalURL } from './actions'; import { subscriptionsSelector } from './selectors'; +import messages from './ManageSubscriptionsPage.messages'; const ManageSubscriptionsPage = () => { const { formatMessage } = useIntl(); @@ -15,12 +16,9 @@ const ManageSubscriptionsPage = () => { subscriptionsSelector, ); - const buttonLabel = formatMessage({ - id: 'ecommerce.order.history.manage.subscriptions.button', - defaultMessage: 'Orders and subscriptions', - description: - 'Button label to navigate to the orders and subscriptions page.', - }); + const buttonLabel = formatMessage( + messages['ecommerce.order.history.manage.subscriptions.button'], + ); useEffect(() => { dispatch(fetchStripeCustomerPortalURL()); @@ -35,11 +33,9 @@ const ManageSubscriptionsPage = () => { const renderLoading = () => ( <PageLoading - srMessage={formatMessage({ - id: 'ecommerce.order.history.loading.manage.subscriptions', - defaultMessage: 'Loading manage subscriptions...', - description: 'Message when loading the manage subscriptions page.', - })} + srMessage={formatMessage( + messages['ecommerce.order.history.manage.subscriptions.loading'], + )} /> ); diff --git a/src/subscriptions/ManageSubscriptionsPage.messages.js b/src/subscriptions/ManageSubscriptionsPage.messages.js new file mode 100644 index 00000000..d15e030b --- /dev/null +++ b/src/subscriptions/ManageSubscriptionsPage.messages.js @@ -0,0 +1,17 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; + +const messages = defineMessages({ + 'ecommerce.order.history.manage.subscriptions.button': { + id: 'ecommerce.order.history.manage.subscriptions.button', + defaultMessage: 'Orders and subscriptions', + description: + 'Button label to navigate to the orders and subscriptions page.', + }, + 'ecommerce.order.history.manage.subscriptions.loading': { + id: 'ecommerce.order.history.manage.subscriptions.loading', + defaultMessage: 'Loading manage subscriptions...', + description: 'Message when loading the manage subscriptions page.', + }, +}); + +export default messages;