Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Untranslatable strings #1193 #1449

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions src/instructor-toolbar/InstructorToolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { getConfig } from '@edx/frontend-platform';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';

import { ALERT_TYPES, AlertList } from '../generic/user-messages';
import Alert from '../generic/user-messages/Alert';
import messages from './messages';
import MasqueradeWidget from './masquerade-widget';
import { useAccessExpirationMasqueradeBanner } from '../alerts/access-expiration-alert';
import { useCourseStartMasqueradeBanner } from '../alerts/course-start-alert';
Expand Down Expand Up @@ -75,17 +77,17 @@ const InstructorToolbar = (props) => {
{(urlStudio || urlInsights) && (
<>
<hr className="border-light" />
<span className="mr-2 mt-1 col-form-label">View course in:</span>
<span className="mr-2 mt-1 col-form-label">{props.intl.formatMessage(messages.titleViewAs)}</span>
</>
)}
{urlStudio && (
<span className="mx-1 my-1">
<a className="btn btn-inverse-outline-primary" href={urlStudio}>Studio</a>
<a className="btn btn-inverse-outline-primary" href={urlStudio}>{props.intl.formatMessage(messages.titleStudio)}</a>
</span>
)}
{urlInsights && (
<span className="mx-1 my-1">
<a className="btn btn-inverse-outline-primary" href={urlInsights}>Insights</a>
<a className="btn btn-inverse-outline-primary" href={urlInsights}>{props.intl.formatMessage(messages.titleInsights)}</a>
</span>
)}
</div>
Expand Down Expand Up @@ -115,6 +117,7 @@ InstructorToolbar.propTypes = {
courseId: PropTypes.string,
unitId: PropTypes.string,
tab: PropTypes.string,
intl: intlShape.isRequired,
};

InstructorToolbar.defaultProps = {
Expand All @@ -123,4 +126,4 @@ InstructorToolbar.defaultProps = {
tab: '',
};

export default InstructorToolbar;
export default injectIntl(InstructorToolbar);
jciasenza marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions src/instructor-toolbar/masquerade-widget/MasqueradeWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MasqueradeWidget extends Component {
this.courseId = props.courseId;
this.state = {
autoFocus: false,
masquerade: 'Staff',
masquerade: this.props.intl.formatMessage(messages.buttonStaff),
options: [],
shouldShowUserNameInput: false,
masqueradeUsername: null,
Expand Down Expand Up @@ -71,7 +71,7 @@ class MasqueradeWidget extends Component {
toggle(show) {
this.setState(prevState => ({
autoFocus: true,
masquerade: 'Specific Student...',
masquerade: this.props.intl.formatMessage(messages.buttonSpecificStudent),
shouldShowUserNameInput: show === undefined ? !prevState.shouldShowUserNameInput : show,
}));
}
Expand All @@ -96,7 +96,7 @@ class MasqueradeWidget extends Component {
if (active.userName) {
this.setState({
autoFocus: false,
masquerade: 'Specific Student...',
masquerade: this.props.intl.formatMessage(messages.buttonSpecificStudent),
masqueradeUsername: active.userName,
shouldShowUserNameInput: true,
});
Expand All @@ -120,7 +120,7 @@ class MasqueradeWidget extends Component {
return (
<div className="flex-grow-1">
<div className="row">
<span className="col-auto col-form-label pl-3">View this course as:</span>
<span className="col-auto col-form-label pl-3">{this.props.intl.formatMessage(messages.titleViewCourseIn)}</span>
jciasenza marked this conversation as resolved.
Show resolved Hide resolved
<Dropdown className="flex-shrink-1 mx-1">
<Dropdown.Toggle id="masquerade-widget-toggle" variant="inverse-outline-primary">
{masquerade}
Expand All @@ -135,7 +135,7 @@ class MasqueradeWidget extends Component {
<span className="col-auto col-form-label pl-3" id="masquerade-search-label">{`${specificLearnerInputText}:`}</span>
<MasqueradeUserNameInput
id="masquerade-search"
className="col-4"
className="col-4 form-control"
autoFocus={autoFocus}
defaultValue={masqueradeUsername}
onError={(errorMessage) => this.onError(errorMessage)}
Expand Down
15 changes: 15 additions & 0 deletions src/instructor-toolbar/masquerade-widget/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ const messages = defineMessages({
defaultMessage: 'Masquerade as this user',
description: 'Label for the masquerade user input',
},
titleViewCourseIn: {
id: 'instructor.toolbar.view.course',
defaultMessage: 'View course in: ',
description: 'Button to view the course in the studio',
},
buttonStaff: {
id: 'buttonStaff',
defaultMessage: 'Staff',
description: 'Button to see the different staff options',
},
buttonSpecificStudent: {
id: 'buttonSpecificStudent',
defaultMessage: 'Specific Student...',
description: 'Button specific student',
},
});

export default messages;
21 changes: 21 additions & 0 deletions src/instructor-toolbar/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
titleViewAs: {
id: 'instructor.toolbar.view.as',
defaultMessage: 'View this course as: ',
description: 'Button to view this course as',
},
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;
Loading