Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

fix: Internationalization of ErrorPage when Cookies aren't available #752

Merged
merged 1 commit into from
May 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import ReactDOM from 'react-dom';
import { Route, Switch } from 'react-router-dom';

import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { logError } from '@edx/frontend-platform/logging';
import { getLoggingService, logError } from '@edx/frontend-platform/logging';
import Header, { messages as headerMessages } from '@edx/frontend-component-header';
import Footer, { messages as footerMessages } from '@edx/frontend-component-footer';

import { configure as configureI18n } from '@edx/frontend-platform/i18n/lib';
import { getLocale } from '@edx/frontend-platform/i18n';
import appMessages from './i18n';
import {
PaymentPage,
Expand Down Expand Up @@ -101,6 +103,15 @@ subscribe(APP_READY, () => {
});

subscribe(APP_INIT_ERROR, (error) => {
try {
getLocale('en');
} catch (e) {
configureI18n({
messages: {},
config: getConfig(),
loggingService: getLoggingService(),
});
}
ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));
});

Expand Down