Skip to content

Commit

Permalink
chore: fix some missing internationalization
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Apr 11, 2024
1 parent 584e95a commit 650b733
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/search-modal/BlockTypeLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const BlockTypeLabel = ({ type }) => {
// Replace underscores and hypens with spaces, then let the browser capitalize this
// in a locale-aware way to get a reasonable display value.
// e.g. 'drag-and-drop-v2' -> "Drag And Drop V2"
return <span style={{ textTransform: 'capitalize' }}>XXX {type.replace(/[_-]/g, ' ')}</span>;
return <span style={{ textTransform: 'capitalize' }}>{type.replace(/[_-]/g, ' ')}</span>;
};

export default BlockTypeLabel;
5 changes: 2 additions & 3 deletions src/search-modal/SearchUI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,21 @@ const SearchUI = (props) => {
<ModalDialog.Title><FormattedMessage {...messages.title} /></ModalDialog.Title>
<div className="d-flex mt-3">
<SearchKeywordsField className="flex-grow-1 mr-1" />
{/* Give this toggle button a fixed width so it doesn't change size when the selected option changes */}
<SelectMenu variant="primary">
<MenuItem
onClick={switchToThisCourse}
defaultSelected={searchThisCourse}
iconAfter={searchThisCourse ? Check : undefined}
disabled={!props.courseId}
>
This course
<FormattedMessage {...messages.searchThisCourse} />
</MenuItem>
<MenuItem
onClick={switchToAllCourses}
defaultSelected={!searchThisCourse}
iconAfter={searchThisCourse ? undefined : Check}
>
All courses
<FormattedMessage {...messages.searchAllCourses} />
</MenuItem>
</SelectMenu>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/search-modal/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ const messages = defineMessages({
defaultMessage: '{numResults, plural, one {# result} other {# results}} found',
description: 'This count displays how many matching results were found from the user\'s search',
},
searchAllCourses: {
id: 'course-authoring.course-search.searchAllCourses',
defaultMessage: 'All courses',
description: 'Option to get search results from all courses.',
},
searchThisCourse: {
id: 'course-authoring.course-search.searchThisCourse',
defaultMessage: 'This course',
description: 'Option to limit search results to the current course only.',
},
title: {
id: 'course-authoring.course-search.title',
defaultMessage: 'Search',
Expand Down

0 comments on commit 650b733

Please sign in to comment.