From a9292fcb2f662f5772a6681422954fedf01ada92 Mon Sep 17 00:00:00 2001 From: Jonathan Boiser Date: Wed, 19 May 2021 11:22:41 -0700 Subject: [PATCH] Move facility ID out of quoted phrase Fixes #7123 --- kolibri/core/assets/src/mixins/commonCoreStrings.js | 2 +- kolibri/core/assets/src/mixins/taskStrings.js | 6 +++--- .../assets/src/views/__test__/syncTaskUtils.spec.js | 10 +++++----- .../plugins/device/assets/src/views/syncTaskUtils.js | 4 +--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/kolibri/core/assets/src/mixins/commonCoreStrings.js b/kolibri/core/assets/src/mixins/commonCoreStrings.js index 0ffa1df807..652a43bfbf 100644 --- a/kolibri/core/assets/src/mixins/commonCoreStrings.js +++ b/kolibri/core/assets/src/mixins/commonCoreStrings.js @@ -93,7 +93,7 @@ export const coreStrings = createTranslator('CommonCoreStrings', { invalidCredentialsError: 'Incorrect username or password', // Formatting - nameWithIdInParens: '{name} ({id})', + nameWithIdInParens: `'{name}' ({id})`, quotedPhrase: `'{phrase}'`, dashSeparatedPair: '{item1} - {item2}', dashSeparatedTriple: '{item1} - {item2} - {item3}', diff --git a/kolibri/core/assets/src/mixins/taskStrings.js b/kolibri/core/assets/src/mixins/taskStrings.js index a1625f9681..f7b78a78e2 100644 --- a/kolibri/core/assets/src/mixins/taskStrings.js +++ b/kolibri/core/assets/src/mixins/taskStrings.js @@ -69,7 +69,7 @@ const taskStrings = createTranslator('TaskStrings', { context: 'Sync task status', }, syncFacilityTaskLabel: { - message: "Sync '{facilityName}'", + message: 'Sync {facilityName}', context: 'Description of sync-facility task', }, syncStepAndDescription: { @@ -87,7 +87,7 @@ const taskStrings = createTranslator('TaskStrings', { context: 'Remove facility task status', }, removeFacilityTaskLabel: { - message: "Remove '{facilityName}'", + message: 'Remove {facilityName}', context: 'Description of a remove-facility task', }, removeFacilitySuccessStatus: { @@ -97,7 +97,7 @@ const taskStrings = createTranslator('TaskStrings', { // Import Facility Task strings importFacilityTaskLabel: { - message: "Import '{facilityName}'", + message: 'Import {facilityName}', context: 'Description of import-facility task', }, importSuccessStatus: { diff --git a/kolibri/plugins/device/assets/src/views/__test__/syncTaskUtils.spec.js b/kolibri/plugins/device/assets/src/views/__test__/syncTaskUtils.spec.js index 26c6da525c..1f3e01035b 100644 --- a/kolibri/plugins/device/assets/src/views/__test__/syncTaskUtils.spec.js +++ b/kolibri/plugins/device/assets/src/views/__test__/syncTaskUtils.spec.js @@ -40,14 +40,14 @@ describe('syncTaskUtils.syncFacilityTaskDisplayInfo', () => { const task = makeTask('RUNNING'); task.type = 'SYNCPEER/FULL'; const displayInfo = syncFacilityTaskDisplayInfo(task); - expect(displayInfo.headingMsg).toEqual("Sync 'generic facility (fac1)'"); + expect(displayInfo.headingMsg).toEqual("Sync 'generic facility' (fac1)"); }); it('displays the correct header for facility-import tasks', () => { const task = makeTask('RUNNING'); task.type = 'SYNCPEER/PULL'; const displayInfo = syncFacilityTaskDisplayInfo(task); - expect(displayInfo.headingMsg).toEqual("Import 'generic facility (fac1)'"); + expect(displayInfo.headingMsg).toEqual("Import 'generic facility' (fac1)"); }); it('display title, started by username, and device name are invariant wrt status', () => { @@ -63,9 +63,9 @@ describe('syncTaskUtils.syncFacilityTaskDisplayInfo', () => { ALL_STATUSES.forEach(status => { task.status = status; expect(syncFacilityTaskDisplayInfo(task)).toMatchObject({ - headingMsg: "Sync 'invariant facility (fac1)'", + headingMsg: "Sync 'invariant facility' (fac1)", startedByMsg: "Started by 'invariant user'", - deviceNameMsg: "'invariant device (dev1)'", + deviceNameMsg: "'invariant device' (dev1)", }); }); }); @@ -164,7 +164,7 @@ describe('syncTaskUtils.removeFacilityTaskDisplayInfo', () => { ALL_STATUSES.forEach(status => { const task = makeTask(status); expect(removeFacilityTaskDisplayInfo(task)).toMatchObject({ - headingMsg: "Remove 'removed facility (fac1)'", + headingMsg: "Remove 'removed facility' (fac1)", startedByMsg: "Started by 'removing user'", }); }); diff --git a/kolibri/plugins/device/assets/src/views/syncTaskUtils.js b/kolibri/plugins/device/assets/src/views/syncTaskUtils.js index 6be1cdeb91..c2424f5080 100644 --- a/kolibri/plugins/device/assets/src/views/syncTaskUtils.js +++ b/kolibri/plugins/device/assets/src/views/syncTaskUtils.js @@ -72,9 +72,7 @@ export function syncFacilityTaskDisplayInfo(task) { if (task.type === TaskTypes.SYNCDATAPORTAL) { deviceNameMsg = 'Kolibri Data Portal'; } else if (task.device_name) { - deviceNameMsg = coreString('quotedPhrase', { - phrase: formatNameWithId(task.device_name, task.device_id), - }); + deviceNameMsg = formatNameWithId(task.device_name, task.device_id); } const syncStep = syncTaskStatusToStepMap[task.sync_state]; const statusDescription =