From f3dd269ec7fe874a04a9f34dfd65f71e8bc560c2 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 31 Mar 2025 00:57:22 -0500 Subject: [PATCH 1/3] fix: fixed some strings in learning not showing properly --- src/instructor-toolbar/InstructorToolbar.jsx | 10 +++++---- .../masquerade-widget/MasqueradeWidget.jsx | 7 +++---- .../masquerade-widget/messages.js | 10 +++++++++ src/instructor-toolbar/messages.ts | 21 +++++++++++++++++++ 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 src/instructor-toolbar/messages.ts diff --git a/src/instructor-toolbar/InstructorToolbar.jsx b/src/instructor-toolbar/InstructorToolbar.jsx index 71d968c869..c4529e1574 100644 --- a/src/instructor-toolbar/InstructorToolbar.jsx +++ b/src/instructor-toolbar/InstructorToolbar.jsx @@ -1,10 +1,12 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { getConfig } from '@edx/frontend-platform'; +import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; import { ALERT_TYPES, AlertList } from '../generic/user-messages'; import Alert from '../generic/user-messages/Alert'; import MasqueradeWidget from './masquerade-widget'; +import messages from './messages'; import { useAccessExpirationMasqueradeBanner } from '../alerts/access-expiration-alert'; import { useCourseStartMasqueradeBanner } from '../alerts/course-start-alert'; @@ -61,7 +63,7 @@ const InstructorToolbar = (props) => { const urlInsights = getInsightsUrl(courseId); const urlStudio = getStudioUrl(courseId, unitId); const [masqueradeErrorMessage, showMasqueradeError] = useState(null); - + const { formatMessage } = useIntl(); const accessExpirationMasqueradeBanner = useAccessExpirationMasqueradeBanner(courseId, tab); const courseStartDateMasqueradeBanner = useCourseStartMasqueradeBanner(courseId, tab); @@ -75,17 +77,17 @@ const InstructorToolbar = (props) => { {(urlStudio || urlInsights) && ( <>
- View course in: + )} {urlStudio && ( - Studio + {formatMessage(messages.titleStudio)} )} {urlInsights && ( - Insights + {formatMessage(messages.titleInsights)} )} diff --git a/src/instructor-toolbar/masquerade-widget/MasqueradeWidget.jsx b/src/instructor-toolbar/masquerade-widget/MasqueradeWidget.jsx index 0808f0ec41..565a65501b 100644 --- a/src/instructor-toolbar/masquerade-widget/MasqueradeWidget.jsx +++ b/src/instructor-toolbar/masquerade-widget/MasqueradeWidget.jsx @@ -2,11 +2,10 @@ import React, { Component, } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; import { Dropdown } from '@openedx/paragon'; import { UserMessagesContext } from '../../generic/user-messages'; - import MasqueradeUserNameInput from './MasqueradeUserNameInput'; import MasqueradeWidgetOption from './MasqueradeWidgetOption'; import { @@ -21,7 +20,7 @@ class MasqueradeWidget extends Component { this.courseId = props.courseId; this.state = { autoFocus: false, - masquerade: 'Staff', + masquerade: this.props.intl.formatMessage(messages.titleStaff), options: [], shouldShowUserNameInput: false, masqueradeUsername: null, @@ -120,7 +119,7 @@ class MasqueradeWidget extends Component { return (
- View this course as: + {masquerade} diff --git a/src/instructor-toolbar/masquerade-widget/messages.js b/src/instructor-toolbar/masquerade-widget/messages.js index 4621534c63..c5250420fb 100644 --- a/src/instructor-toolbar/masquerade-widget/messages.js +++ b/src/instructor-toolbar/masquerade-widget/messages.js @@ -16,6 +16,16 @@ const messages = defineMessages({ defaultMessage: 'Masquerade as this user', description: 'Label for the masquerade user input', }, + titleViewAs: { + id: 'instructor.toolbar.view.as', + defaultMessage: 'View this course as:', + description: 'Button to view this course as', + }, + titleStaff: { + id: 'instructor.toolbar.staff', + defaultMessage: 'Staff', + description: 'Button Staff', + }, }); export default messages; diff --git a/src/instructor-toolbar/messages.ts b/src/instructor-toolbar/messages.ts new file mode 100644 index 0000000000..f1ccef4418 --- /dev/null +++ b/src/instructor-toolbar/messages.ts @@ -0,0 +1,21 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; + +const messages = defineMessages({ + titleViewCourseIn: { + id: 'instructor.toolbar.view.course', + defaultMessage: 'View course in:', + description: 'Button to view the course in the studio', + }, + titleStudio: { + id: 'instructor.toolbar.studio', + defaultMessage: 'Studio', + description: 'Button to view in studio', + }, + titleInsights: { + id: 'instructor.toolbar.insights', + defaultMessage: 'Insights', + description: 'Button Insights', + }, +}); + +export default messages; \ No newline at end of file From 5844f1d5ee87a8cbe2b3ab923c29b766b11b7269 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 31 Mar 2025 10:34:58 -0500 Subject: [PATCH 2/3] fix: fixed indentation spaces and messages file extension --- src/instructor-toolbar/InstructorToolbar.jsx | 4 ++-- src/instructor-toolbar/{messages.ts => messages.js} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename src/instructor-toolbar/{messages.ts => messages.js} (100%) diff --git a/src/instructor-toolbar/InstructorToolbar.jsx b/src/instructor-toolbar/InstructorToolbar.jsx index c4529e1574..157495469e 100644 --- a/src/instructor-toolbar/InstructorToolbar.jsx +++ b/src/instructor-toolbar/InstructorToolbar.jsx @@ -82,12 +82,12 @@ const InstructorToolbar = (props) => { )} {urlStudio && ( - {formatMessage(messages.titleStudio)} + {formatMessage(messages.titleStudio)} )} {urlInsights && ( - {formatMessage(messages.titleInsights)} + {formatMessage(messages.titleInsights)} )}
diff --git a/src/instructor-toolbar/messages.ts b/src/instructor-toolbar/messages.js similarity index 100% rename from src/instructor-toolbar/messages.ts rename to src/instructor-toolbar/messages.js From c0cf43c0f9cffc8ef2ed15ecce28fb14c3b035c1 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 31 Mar 2025 10:38:51 -0500 Subject: [PATCH 3/3] chore: added EOL on messages file --- src/instructor-toolbar/messages.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instructor-toolbar/messages.js b/src/instructor-toolbar/messages.js index f1ccef4418..ad3a6c75e5 100644 --- a/src/instructor-toolbar/messages.js +++ b/src/instructor-toolbar/messages.js @@ -18,4 +18,4 @@ const messages = defineMessages({ }, }); -export default messages; \ No newline at end of file +export default messages;