Skip to content

Commit

Permalink
Move strings to searchAndFilterStrings and coachStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Jan 16, 2025
1 parent e952876 commit 58f9ff6
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ const coachStrings = createTranslator('CommonCoachStrings', {
message: 'Deleted',
context: 'Generic notification.',
},
closeConfirmationTitle: {
message: 'Are you sure you want to leave this page?',
context:
'The title of a confirmation modal informing the user that they will lose their work if they leave the page',
},
closeConfirmationMessage: {
message: 'You will lose any unsaved edits to your work',
context:
'Warning message for the user that they will lose their work if they leave the page without saving.',
},

// errors
saveLessonError: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
</template>

<KModal
v-if="isCloseConfirmationOpen"
v-if="isCloseConfirmationModalOpen"
appendToOverlay
:submitText="continueAction$()"
:cancelText="cancelAction$()"
:title="$tr('closeConfirmationTitle')"
@cancel="isCloseConfirmationOpen = false"
:title="closeConfirmationTitle$()"
@cancel="isCloseConfirmationModalOpen = false"
@submit="closeSidePanel(false)"
>
{{ $tr('closeConfirmationMessage') }}
{{ closeConfirmationMessage$() }}
</KModal>
</SidePanelModal>

Expand Down Expand Up @@ -115,7 +115,7 @@
function notifyResourcesAdded(count) {
createSnackbar(resourcesAddedWithCount$({ count }));
}
const { saveLessonError$ } = coachStrings;
const { saveLessonError$, closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
function notifySaveLessonError() {
createSnackbar(saveLessonError$());
}
Expand All @@ -138,14 +138,16 @@
cancelAction$,
continueAction$,
saveAndFinishAction$,
closeConfirmationTitle$,
closeConfirmationMessage$,
};
},
data() {
return {
title: '',
goBack: null,
isSaving: false,
isCloseConfirmationOpen: false,
isCloseConfirmationModalOpen: false,
PageNames,
};
},
Expand Down Expand Up @@ -224,7 +226,7 @@
const newResources = this.getNewResources();
const hasNewResources = newResources.length > this.workingResources.length;
if (hasNewResources && verifyHasNewResources) {
this.isCloseConfirmationOpen = true;
this.isCloseConfirmationModalOpen = true;
} else {
this.$router.push({
name: PageNames.LESSON_SUMMARY_BETTER,
Expand All @@ -238,18 +240,6 @@
this.goBack = goBack;
},
},
$trs: {
closeConfirmationTitle: {
message: 'Are you sure you want to leave this page?',
context:
'The title of a confirmation modal informing the user that they will lose their work if they leave the page',
},
closeConfirmationMessage: {
message: 'You will lose any unsaved edits to your work',
context:
'Warning message for the user that they will lose their work if they leave the page without saving.',
},
},
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@
<span class="row-actions">
<KIconButton
icon="emptyTopic"
:ariaLabel="$tr('openParentFolderLabel')"
:tooltip="$tr('openParentFolderLabel')"
:ariaLabel="openParentFolderLabel$()"
:tooltip="openParentFolderLabel$()"
:disabled="disabled"
@click="navigateToParent(resource)"
/>

<KIconButton
icon="minus"
:ariaLabel="$tr('removeResourceLabel')"
:tooltip="$tr('removeResourceLabel')"
:ariaLabel="removeResourceLabel$()"
:tooltip="removeResourceLabel$()"
:disabled="disabled"
@click="removeResource(resource)"
/>
Expand All @@ -80,7 +80,7 @@
</transition-group>
</DragContainer>
<p v-else>
{{ $tr('emptyResourceList') }}
{{ emptyResourceList$() }}
</p>
</div>

Expand Down Expand Up @@ -114,7 +114,14 @@
setup(props) {
const prevRoute = ref(null);
const { upLabel$, downLabel$, numberOfSelectedResources$ } = searchAndFilterStrings;
const {
upLabel$,
downLabel$,
emptyResourceList$,
removeResourceLabel$,
openParentFolderLabel$,
numberOfSelectedResources$,
} = searchAndFilterStrings;
const { lessonLabel$, sizeLabel$ } = coachStrings;
const instance = getCurrentInstance();
Expand Down Expand Up @@ -148,6 +155,9 @@
downLabel$,
sizeLabel$,
lessonLabel$,
emptyResourceList$,
removeResourceLabel$,
openParentFolderLabel$,
};
},
props: {
Expand Down Expand Up @@ -203,20 +213,6 @@
});
},
},
$trs: {
openParentFolderLabel: {
message: 'Open parent folder',
context: 'Button label to open the parent folder of a resource',
},
removeResourceLabel: {
message: 'Remove resource',
context: 'Button label to remove a resource from the selected resources',
},
emptyResourceList: {
message: 'No resources selected',
context: 'Message displayed when no resources are selected',
},
},
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
import useAccordion from 'kolibri-common/components/useAccordion';
import useSnackbar from 'kolibri/composables/useSnackbar';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import { coachStrings } from '../../common/commonCoachStrings';
import { PageNames } from '../../../constants/index';
export default {
Expand All @@ -175,8 +176,6 @@
replaceQuestions$,
replaceAction$,
selectAllLabel$,
closeConfirmationMessage$,
closeConfirmationTitle$,
replaceQuestionsExplaination$,
replaceQuestionsHeading$,
numberOfSelectedReplacements$,
Expand All @@ -187,6 +186,8 @@
expandAll$,
} = enhancedQuizManagementStrings;
const { closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
const {
// Computed
activeSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import useBaseSearch from 'kolibri-common/composables/useBaseSearch';
import SearchFiltersPanel from 'kolibri-common/components/SearchFiltersPanel';
import { coachStrings } from '../../common/commonCoachStrings';
import { exerciseToQuestionArray } from '../../../utils/selectQuestions';
import { PageNames, ViewMoreButtonStates } from '../../../constants/index';
import BookmarkIcon from '../../lessons/LessonResourceSelectionPage/LessonContentCard/BookmarkIcon.vue';
Expand Down Expand Up @@ -270,8 +271,6 @@
selectResourcesDescription$,
questionsFromResources$,
cannotSelectSomeTopicWarning$,
closeConfirmationMessage$,
closeConfirmationTitle$,
questionsUnusedInSection$,
numberOfQuestionsSelected$,
numberOfQuestionsToAdd$,
Expand All @@ -283,6 +282,8 @@
addNumberOfQuestions$,
} = enhancedQuizManagementStrings;
const { closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
const { windowIsSmall } = useKResponsiveWindow();
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
import { MAX_QUESTIONS_PER_QUIZ_SECTION } from 'kolibri/constants';
import useSnackbar from 'kolibri/composables/useSnackbar';
import { PageNames } from '../../../constants/index';
import { coachStrings } from '../../common/commonCoachStrings.js';
import { injectQuizCreation } from '../../../composables/useQuizCreation.js';
export default {
Expand All @@ -160,15 +161,15 @@
randomizedOptionDescription$,
fixedLabel$,
fixedOptionDescription$,
closeConfirmationMessage$,
closeConfirmationTitle$,
deleteConfirmation$,
addQuestionsLabel$,
addMoreQuestionsLabel$,
sectionDeletedNotification$,
maxNumberOfQuestions$,
} = enhancedQuizManagementStrings;
const { closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
const {
activeSectionIndex,
activeSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import DragSortWidget from 'kolibri-common/components/sortable/DragSortWidget';
import { searchAndFilterStrings } from 'kolibri-common/strings/searchAndFilterStrings';
import { PageNames } from '../../../constants/index';
import { coachStrings } from '../../common/commonCoachStrings.js';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import useDrag from './useDrag.js';
Expand All @@ -112,13 +113,9 @@
},
mixins: [commonCoreStrings],
setup(_, context) {
const {
applySettings$,
sectionOrderLabel$,
currentSection$,
closeConfirmationMessage$,
closeConfirmationTitle$,
} = enhancedQuizManagementStrings;
const { applySettings$, sectionOrderLabel$, currentSection$ } = enhancedQuizManagementStrings;
const { closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
const { activeSectionIndex, activeSection, allSections, updateQuiz } = injectQuizCreation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
import useSnackbar from 'kolibri/composables/useSnackbar';
import { PageNames } from '../../../constants';
import CoachImmersivePage from '../../CoachImmersivePage';
import { coachStrings } from '../../common/commonCoachStrings';
import useQuizCreation from '../../../composables/useQuizCreation';
import AssignmentDetailsModal from '../../common/assignments/AssignmentDetailsModal';
import useCoreCoach from '../../../composables/useCoreCoach';
Expand Down Expand Up @@ -158,8 +159,6 @@
const {
saveAndClose$,
allSectionsEmptyWarning$,
closeConfirmationTitle$,
closeConfirmationMessage$,
changesSavedSuccessfully$,
sectionOrderLabel$,
randomizedLabel$,
Expand All @@ -168,6 +167,8 @@
fixedSectionOptionDescription$,
} = enhancedQuizManagementStrings;
const { closeConfirmationTitle$, closeConfirmationMessage$ } = coachStrings;
return {
closeConfirmationTitle$,
closeConfirmationMessage$,
Expand Down
11 changes: 0 additions & 11 deletions packages/kolibri-common/strings/enhancedQuizManagementStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,6 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag
context:
'A warning message that appears when the user tries to leave the page without saving their work',
},
closeConfirmationTitle: {
message: 'Are you sure you want to leave this page?',
context:
'The title of a confirmation modal informing the user that they will lose their work if they leave the page',
},
closeConfirmationMessage: {
message: 'You will lose any unsaved edits to your work',
context:
'Warning message for the user that they will lose their work if they leave the page without saving.',
},

numberOfSelectedReplacements: {
message:
'{ count, number } of { total, number } {total, plural, one {replacement selected} other {replacements selected}}',
Expand Down
12 changes: 12 additions & 0 deletions packages/kolibri-common/strings/searchAndFilterStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ export const searchAndFilterStrings = createTranslator('SearchAndFilterStrings',
'{count, number, integer} {count, plural, one {resource selected} other {resources selected}}',
context: 'Indicates the number of resources selected',
},
openParentFolderLabel: {
message: 'Open parent folder',
context: 'Button label to open the parent folder of a resource',
},
removeResourceLabel: {
message: 'Remove resource',
context: 'Button label to remove a resource from the selected resources',
},
emptyResourceList: {
message: 'No resources selected',
context: 'Message displayed when no resources are selected',
},
});

0 comments on commit 58f9ff6

Please sign in to comment.