From 3b9f5a2d40b088caa3b3c117937d79f69732bd28 Mon Sep 17 00:00:00 2001 From: Bao Chau Date: Wed, 15 Mar 2017 22:19:18 -0700 Subject: [PATCH 1/4] refactor delete message in translation model. make changes where delete messages are called --- app/admin/custom-forms/index/route.js | 2 +- app/admin/lookup/controller.js | 2 +- app/appointments/delete/template.hbs | 2 +- app/imaging/delete/template.hbs | 2 +- app/inc-category/delete/template.hbs | 2 +- app/inc-category/edit/controller.js | 2 +- app/incident/delete/template.hbs | 2 +- app/incident/edit/controller.js | 2 +- app/incident/note/delete/template.hbs | 2 +- app/inventory/delete/template.hbs | 2 +- app/invoices/delete/template.hbs | 2 +- app/labs/delete/template.hbs | 2 +- app/locales/en/translations.js | 30 ++++------------------- app/medication/delete/template.hbs | 2 +- app/patients/delete/template.hbs | 2 +- app/pricing/delete/template.hbs | 2 +- app/procedures/edit/controller.js | 2 +- app/users/delete/template.hbs | 2 +- app/visits/delete/template.hbs | 2 +- app/visits/procedures/delete/template.hbs | 2 +- app/visits/vitals/delete/template.hbs | 2 +- 21 files changed, 25 insertions(+), 45 deletions(-) diff --git a/app/admin/custom-forms/index/route.js b/app/admin/custom-forms/index/route.js index bfada2526e..7223226074 100644 --- a/app/admin/custom-forms/index/route.js +++ b/app/admin/custom-forms/index/route.js @@ -25,7 +25,7 @@ export default AbstractIndexRoute.extend(ModalHelper, UserSession, { actions: { deleteItem(item) { let i18n = this.get('i18n'); - let message = i18n.t('admin.customForms.messages.deleteForm'); + let message = i18n.t('messages.delete_singular', { name: 'form' }); let model = Ember.Object.create({ itemToDelete: item }); diff --git a/app/admin/lookup/controller.js b/app/admin/lookup/controller.js index 34f10039b6..b4990122fa 100644 --- a/app/admin/lookup/controller.js +++ b/app/admin/lookup/controller.js @@ -348,7 +348,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, confirmDeleteValue(value) { let i18n = this.get('i18n'); let title = i18n.t('admin.lookup.titles.deleteLookupValue'); - let message = i18n.t('admin.lookup.messages.deleteLookupValue', { value }); + let message = i18n.t('messages.delete_singular', { name: value.concat(' value') }); this.displayConfirm(title, message, 'deleteValue', Ember.Object.create({ valueToDelete: value })); diff --git a/app/appointments/delete/template.hbs b/app/appointments/delete/template.hbs index 5a5e5a4aff..938852e6ab 100644 --- a/app/appointments/delete/template.hbs +++ b/app/appointments/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'appointments.messages.deleteAppointmentMessage'}} + {{t 'messages.delete_singular' name='appointment'}}
{{/modal-dialog}} diff --git a/app/imaging/delete/template.hbs b/app/imaging/delete/template.hbs index 67c0414c49..c16cf9664e 100644 --- a/app/imaging/delete/template.hbs +++ b/app/imaging/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'imaging.messages.delete'}} + {{t 'messages.delete_singular' name='imaging request' }}
{{/modal-dialog}} diff --git a/app/inc-category/delete/template.hbs b/app/inc-category/delete/template.hbs index 423bc10579..8c05448025 100644 --- a/app/inc-category/delete/template.hbs +++ b/app/inc-category/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'incident.messages.deleteCategory' name=model.incidentCategoryName}} + {{t 'messages.delete' name=model.incidentCategoryName}}
{{/modal-dialog}} diff --git a/app/inc-category/edit/controller.js b/app/inc-category/edit/controller.js index a703c6c104..bda31dafb1 100644 --- a/app/inc-category/edit/controller.js +++ b/app/inc-category/edit/controller.js @@ -36,7 +36,7 @@ export default AbstractEditController.extend({ showDeleteItem(item) { let i18n = get(this, 'i18n'); - let message = i18n.t('incident.messages.deleteItem'); + let message = i18n.t('messages.delete_singular', { name: 'item' }); let title = i18n.t('incident.titles.deleteItem'); this.displayConfirm(title, message, 'deleteItem', Ember.Object.create({ itemToDelete: item diff --git a/app/incident/delete/template.hbs b/app/incident/delete/template.hbs index d04c76ffae..bc1fe402e0 100644 --- a/app/incident/delete/template.hbs +++ b/app/incident/delete/template.hbs @@ -4,6 +4,6 @@ updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'incident.messages.deleteIncident' name=name}} + {{t 'messages.delete_singular' name='incident'}}
{{/modal-dialog}} diff --git a/app/incident/edit/controller.js b/app/incident/edit/controller.js index d32b177d3b..3e84acae14 100644 --- a/app/incident/edit/controller.js +++ b/app/incident/edit/controller.js @@ -205,7 +205,7 @@ export default AbstractEditController.extend(IncidentStatuses, FriendlyId, Patie showDeleteAttachment(attachment) { let i18n = get(this, 'i18n'); - let message = i18n.t('incident.messages.deleteAttachment'); + let message = i18n.t('messages.delete_singular', { name: 'attachment' }); let model = Ember.Object.create({ itemToDelete: attachment }); diff --git a/app/incident/note/delete/template.hbs b/app/incident/note/delete/template.hbs index 231d3b91da..a9d36c58a4 100644 --- a/app/incident/note/delete/template.hbs +++ b/app/incident/note/delete/template.hbs @@ -1,6 +1,6 @@ {{#modal-dialog isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'incident.messages.deleteNote'}} + {{t 'messages.delete_singular' name='note'}}
{{/modal-dialog}} diff --git a/app/inventory/delete/template.hbs b/app/inventory/delete/template.hbs index 50c96c396f..a06fa1ba91 100644 --- a/app/inventory/delete/template.hbs +++ b/app/inventory/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
  - {{t 'inventory.messages.delete' name=model.name}} + {{t 'messages.delete' name=model.name}}
{{/modal-dialog}} diff --git a/app/invoices/delete/template.hbs b/app/invoices/delete/template.hbs index 2adb704a9d..4ddde84f38 100644 --- a/app/invoices/delete/template.hbs +++ b/app/invoices/delete/template.hbs @@ -6,6 +6,6 @@ {{#em-form model=model submitButton=false }}{{/em-form}}
- {{t 'billing.alerts.deleteItem' item=model.displayInvoiceNumber}} + {{t 'messages.delete' name=model.displayInvoiceNumber}}
{{/modal-dialog}} diff --git a/app/labs/delete/template.hbs b/app/labs/delete/template.hbs index c4545f9077..b5ad3be9dd 100644 --- a/app/labs/delete/template.hbs +++ b/app/labs/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'labs.messages.confirmDeletion'}} + {{t 'messages.delete_singular' name='lab request'}}
{{/modal-dialog}} diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js index bd0c908b59..dd25964e78 100644 --- a/app/locales/en/translations.js +++ b/app/locales/en/translations.js @@ -178,7 +178,6 @@ export default { dischargeReportFormType: 'Discharge Report' }, messages: { - deleteForm: 'Are you sure you want to delete this custom form?', formSaved: 'The {{name}} form has been saved.' }, titles: { @@ -244,9 +243,6 @@ export default { visitLocationList: 'Visit Locations', visitTypes: 'Visit Types', wardPricingTypes: 'Ward Pricing Types', - messages: { - deleteLookupValue: 'Are you sure you want to delete the {{value}} value?' - }, titles: { deleteLookupValue: 'Delete Value' } @@ -467,7 +463,6 @@ export default { createNewRecord: 'Create a new record?', createNewUser: 'Create a new user?', noUsersFound: 'No users found.', - areYouSureDelete: 'Are you sure you wish to delete the user {{user}}?', userHasBeenSaved: 'The user has been saved.', userSaved: 'User Saved', onBehalfOf: 'on behalf of', @@ -477,7 +472,10 @@ export default { forAuthorizedPersons: 'This report is for authorized persons only.', requiredFieldsCorrectErrors: 'Please fill in required fields (marked with *) and correct the errors before saving.', saveActionException: 'An error occurred while attempting to save: {{message}}', - reportError: 'An error was encountered while generating the requested report. Please let your system administrator know that you have encountered an error.' + reportError: 'An error was encountered while generating the requested report. Please let your system administrator know that you have encountered an error.', + delete: 'Are you sure you wish to delete {{name}}?', + delete_singular: 'Are you sure you wish to delete this {{name}}?', + delete_plural: 'Are you sure you wish to delete these {{name}}?' }, alerts: { pleaseWait: 'Please Wait', @@ -655,7 +653,6 @@ export default { messages: { adjust: 'Please adjust the quantities on the appropriate location(s) to account for the difference of {{difference}}.', createRequest: 'Create a new request?', - delete: 'Are you sure you wish to delete {{name}}?', itemNotFound: 'The inventory item {{item}} could not be found.
If you would like to create a new inventory item, fill in the information below.
Otherwise, press the Cancel button to return.', loading: 'Loading transactions ...', purchaseSaved: 'The inventory purchases have been successfully saved.', @@ -743,7 +740,6 @@ export default { addNewVisit: '--Add New Visit--' }, messages: { - delete: 'Are you sure you wish to delete this imaging request?', noCompleted: 'No completed items found.' }, titles: { @@ -812,11 +808,6 @@ export default { attachmentFileRequired: 'Please upload a file or take a picture or before saving this attachment.', createNew: 'Create a new incident?', createNewIncidentCategory: 'Create a new Incident Category?', - deleteAttachment: 'Are you sure you wish to delete this attachment?', - deleteCategory: 'Are you sure you wish to delete {{name}}?', - deleteIncident: 'Are you sure you wish to delete this incident?', - deleteItem: 'Are you sure you want to delete this item?', - deleteNote: 'Are you sure you wish to delete this note?', fillIn: 'Fill in the above options to calculate score', incidentCategorySaved: 'The {{name}} category has been saved.', noClosedIncidents: 'No closed incidents found.', @@ -872,8 +863,7 @@ export default { newMedicationRequest: 'New Medication Request' }, messages: { - createNew: 'Create a new medication request?', - confirmDeletion: 'Are you sure you wish to delete this medication request?' + createNew: 'Create a new medication request?' }, labels: { refills: 'Refills', @@ -907,7 +897,6 @@ export default { calendarTitle: 'Appointments Calendar', messages: { appointmentSaved: 'The appointment for {{patient}} has been saved.', - deleteAppointmentMessage: 'Are you sure you wish to delete this appointment?', endTimeLaterThanStart: 'Please select an end time later than the start time.' }, buttons: { @@ -926,9 +915,6 @@ export default { } }, vitals: { - messages: { - delete: 'Are you sure you wish to delete these vitals?' - }, labels: { dateRecorded: 'Date Recorded', temperature: 'Temperature', @@ -953,7 +939,6 @@ export default { visitSaved: 'Visit Saved' }, messages: { - delete: 'Are you sure you wish to delete this visit?', checkOut: 'Are you sure you wish to check out {{patientName}}?', checkedOut: '{{patientName}} has been checked out.', discharged: '{{patientName}} has been discharged.', @@ -1022,7 +1007,6 @@ export default { messages: { noItemsFound: 'No labs found.', createNewRecord: 'Create a new record?', - confirmDeletion: 'Are you sure you wish to delete this lab request?', noCompleted: 'No completed items found.' }, buttons: { @@ -1085,7 +1069,6 @@ export default { }, messages: { areYouSureDelete: 'Are you sure you want to delete this {{object}}?', - deletePatient: 'Are you sure you wish to delete {{firstName}} {{lastName}}?', noPatientsFound: 'No patients found.', savedPatient: 'The patient record for {{displayName}} has been saved.', notFoundQuickAdd: 'The patient {{patientFullName}} could not be found. If you would like to create a new patient, fill in the information below. Otherwise press the Cancel button to return.', @@ -1168,7 +1151,6 @@ export default { billing: { alerts: { noInvoiceFound: 'No invoices found', - deleteItem: 'Are you sure you wish to delete {{item}}?', noPricingItems: 'No pricing items found.', noPricingProfiles: 'No pricing profiles found.' }, @@ -1232,8 +1214,6 @@ export default { medicationUsed: 'Medication Used' }, messages: { - deleteMedication: 'Are you sure you want to delete this medication?', - delete: 'Are you sure you wish to delete this procedure?', saved: 'The procedure record has been saved.' }, buttons: { diff --git a/app/medication/delete/template.hbs b/app/medication/delete/template.hbs index 9a074340fb..dd8137049b 100644 --- a/app/medication/delete/template.hbs +++ b/app/medication/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'medication.messages.confirmDeletion'}} + {{t 'messages.delete_singular' name='medication request'}}
{{/modal-dialog}} diff --git a/app/patients/delete/template.hbs b/app/patients/delete/template.hbs index fad91fb92b..1517a943b6 100644 --- a/app/patients/delete/template.hbs +++ b/app/patients/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'patients.messages.deletePatient' firstName=model.firstName lastName=model.lastName}} + {{t 'messages.delete' name=(concat model.firstName " " model.lastName)}}
{{/modal-dialog}} diff --git a/app/pricing/delete/template.hbs b/app/pricing/delete/template.hbs index 8606bb6000..3b288441b6 100644 --- a/app/pricing/delete/template.hbs +++ b/app/pricing/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'billing.alerts.deleteItem' item=model.name}} + {{t 'messages.delete' name=model.name}}
{{/modal-dialog}} diff --git a/app/procedures/edit/controller.js b/app/procedures/edit/controller.js index 7e38db1f11..f3a07f19b3 100644 --- a/app/procedures/edit/controller.js +++ b/app/procedures/edit/controller.js @@ -83,7 +83,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { closeModalOnConfirm: false, confirmAction: 'deleteCharge', title: this.get('i18n').t('procedures.titles.deleteMedicationUsed'), - message: this.get('i18n').t('procedures.messages.deleteMedication'), + message: this.get('i18n').t('messages.delete_singular', { name: 'medication' }), chargeToDelete: charge, updateButtonAction: 'confirm', updateButtonText: this.get('i18n').t('buttons.ok') diff --git a/app/users/delete/template.hbs b/app/users/delete/template.hbs index 2b740fb8d7..bef8ce7e11 100644 --- a/app/users/delete/template.hbs +++ b/app/users/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.areYouSureDelete' user=model.name}} + {{t 'messages.delete' name=(concat "the user " model.name)}}
{{/modal-dialog}} diff --git a/app/visits/delete/template.hbs b/app/visits/delete/template.hbs index b0405e164a..e7ed836cd6 100644 --- a/app/visits/delete/template.hbs +++ b/app/visits/delete/template.hbs @@ -5,7 +5,7 @@ updateButtonText=updateButtonText }}
- {{t 'visits.messages.delete'}} + {{t 'messages.delete_singular' name='visit'}}
diff --git a/app/visits/procedures/delete/template.hbs b/app/visits/procedures/delete/template.hbs index 77ae629918..0de216d3d1 100644 --- a/app/visits/procedures/delete/template.hbs +++ b/app/visits/procedures/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "procedures.messages.delete"}} + {{t "messages.delete_singular" name='procedure'}}
{{/modal-dialog}} diff --git a/app/visits/vitals/delete/template.hbs b/app/visits/vitals/delete/template.hbs index 3d6eeb7efb..b0293c2b52 100644 --- a/app/visits/vitals/delete/template.hbs +++ b/app/visits/vitals/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "vitals.messages.delete"}} + {{t "messages.delete_plural" name='vitals'}}
{{/modal-dialog}} From 47bdefc6018e19a5d5b06ab0972109efd28baba7 Mon Sep 17 00:00:00 2001 From: Bao Chau Date: Thu, 16 Mar 2017 10:56:45 -0700 Subject: [PATCH 2/4] replace non-localized with localized strings. add localizedStrings under models translation file. --- app/admin/custom-forms/index/route.js | 2 +- app/admin/lookup/controller.js | 2 +- app/appointments/delete/template.hbs | 3 ++- app/imaging/delete/template.hbs | 2 +- app/inc-category/edit/controller.js | 3 ++- app/incident/delete/template.hbs | 2 +- app/incident/edit/controller.js | 3 ++- app/incident/note/delete/template.hbs | 2 +- app/labs/delete/template.hbs | 2 +- app/locales/en/translations.js | 16 ++++++++++++++++ app/medication/delete/template.hbs | 2 +- app/procedures/edit/controller.js | 3 ++- app/users/delete/template.hbs | 2 +- app/visits/delete/template.hbs | 2 +- app/visits/procedures/delete/template.hbs | 2 +- app/visits/vitals/delete/template.hbs | 2 +- tests/acceptance/users-test.js | 2 +- 17 files changed, 36 insertions(+), 16 deletions(-) diff --git a/app/admin/custom-forms/index/route.js b/app/admin/custom-forms/index/route.js index 7223226074..7b1310e047 100644 --- a/app/admin/custom-forms/index/route.js +++ b/app/admin/custom-forms/index/route.js @@ -25,10 +25,10 @@ export default AbstractIndexRoute.extend(ModalHelper, UserSession, { actions: { deleteItem(item) { let i18n = this.get('i18n'); - let message = i18n.t('messages.delete_singular', { name: 'form' }); let model = Ember.Object.create({ itemToDelete: item }); + let message = i18n.t('messages.delete', { name: item.get('name') }); let title = i18n.t('admin.customForms.titles.deleteForm'); this.displayConfirm(title, message, 'deleteCustomForm', model); }, diff --git a/app/admin/lookup/controller.js b/app/admin/lookup/controller.js index b4990122fa..070db7b997 100644 --- a/app/admin/lookup/controller.js +++ b/app/admin/lookup/controller.js @@ -348,7 +348,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, confirmDeleteValue(value) { let i18n = this.get('i18n'); let title = i18n.t('admin.lookup.titles.deleteLookupValue'); - let message = i18n.t('messages.delete_singular', { name: value.concat(' value') }); + let message = i18n.t('messages.delete', { name: value }); this.displayConfirm(title, message, 'deleteValue', Ember.Object.create({ valueToDelete: value })); diff --git a/app/appointments/delete/template.hbs b/app/appointments/delete/template.hbs index 938852e6ab..440d49beaa 100644 --- a/app/appointments/delete/template.hbs +++ b/app/appointments/delete/template.hbs @@ -5,6 +5,7 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name='appointment'}} + + {{t 'messages.delete_singular' name= (t 'models.localizedStrings.appointment') }}
{{/modal-dialog}} diff --git a/app/imaging/delete/template.hbs b/app/imaging/delete/template.hbs index c16cf9664e..ce959e4508 100644 --- a/app/imaging/delete/template.hbs +++ b/app/imaging/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name='imaging request' }} + {{t 'messages.delete_singular' name=(t models.localizedStrings.imagingRequest) }}
{{/modal-dialog}} diff --git a/app/inc-category/edit/controller.js b/app/inc-category/edit/controller.js index bda31dafb1..49dc2b6d2a 100644 --- a/app/inc-category/edit/controller.js +++ b/app/inc-category/edit/controller.js @@ -36,7 +36,8 @@ export default AbstractEditController.extend({ showDeleteItem(item) { let i18n = get(this, 'i18n'); - let message = i18n.t('messages.delete_singular', { name: 'item' }); + let modelName = i18n.t('models.localizedStrings.item'); + let message = i18n.t('messages.delete_singular', { name: modelName }); let title = i18n.t('incident.titles.deleteItem'); this.displayConfirm(title, message, 'deleteItem', Ember.Object.create({ itemToDelete: item diff --git a/app/incident/delete/template.hbs b/app/incident/delete/template.hbs index bc1fe402e0..e7fc0d478a 100644 --- a/app/incident/delete/template.hbs +++ b/app/incident/delete/template.hbs @@ -4,6 +4,6 @@ updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'messages.delete_singular' name='incident'}} + {{t 'messages.delete_singular' name=(t 'models.localizedStrings.incident')}}
{{/modal-dialog}} diff --git a/app/incident/edit/controller.js b/app/incident/edit/controller.js index 3e84acae14..9f9c8113f2 100644 --- a/app/incident/edit/controller.js +++ b/app/incident/edit/controller.js @@ -205,7 +205,8 @@ export default AbstractEditController.extend(IncidentStatuses, FriendlyId, Patie showDeleteAttachment(attachment) { let i18n = get(this, 'i18n'); - let message = i18n.t('messages.delete_singular', { name: 'attachment' }); + let modelName = i18n.t('models.localizedStrings.attachment'); + let message = i18n.t('messages.delete_singular', { name: modelName }); let model = Ember.Object.create({ itemToDelete: attachment }); diff --git a/app/incident/note/delete/template.hbs b/app/incident/note/delete/template.hbs index a9d36c58a4..89d6fa8171 100644 --- a/app/incident/note/delete/template.hbs +++ b/app/incident/note/delete/template.hbs @@ -1,6 +1,6 @@ {{#modal-dialog isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'messages.delete_singular' name='note'}} + {{t 'messages.delete_singular' name=(t 'models.localizedStrings.note')}}
{{/modal-dialog}} diff --git a/app/labs/delete/template.hbs b/app/labs/delete/template.hbs index b5ad3be9dd..58c4f16024 100644 --- a/app/labs/delete/template.hbs +++ b/app/labs/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name='lab request'}} + {{t 'messages.delete_singular' name=(t 'models.localizedStrings.labRequest')}}
{{/modal-dialog}} diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js index dd25964e78..5ee215886c 100644 --- a/app/locales/en/translations.js +++ b/app/locales/en/translations.js @@ -1465,6 +1465,22 @@ export default { names: { singular: 'Patient' } + }, + localizedStrings: { + appointment: 'appointment', + medication: 'medication', + form: 'form', + imagingRequest: 'imaging request', + item: 'item', + incident: 'incident', + attachment: 'attachment', + note: 'note', + labRequest: 'lab request', + medicationRequest: 'medication request', + procedure: 'procedure', + user: 'user', + visit: 'visit', + vitals: 'vitals' } } }; diff --git a/app/medication/delete/template.hbs b/app/medication/delete/template.hbs index dd8137049b..c074b16699 100644 --- a/app/medication/delete/template.hbs +++ b/app/medication/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name='medication request'}} + {{t 'messages.delete_singular' name=(t 'models.localizedStrings.medicationRequest')}}
{{/modal-dialog}} diff --git a/app/procedures/edit/controller.js b/app/procedures/edit/controller.js index f3a07f19b3..b9269f5263 100644 --- a/app/procedures/edit/controller.js +++ b/app/procedures/edit/controller.js @@ -83,7 +83,8 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { closeModalOnConfirm: false, confirmAction: 'deleteCharge', title: this.get('i18n').t('procedures.titles.deleteMedicationUsed'), - message: this.get('i18n').t('messages.delete_singular', { name: 'medication' }), + name: this.get('i18n').t('models.localizedStrings.medication'), + message: this.get('i18n').t('messages.delete_singular', { name: this.name }), chargeToDelete: charge, updateButtonAction: 'confirm', updateButtonText: this.get('i18n').t('buttons.ok') diff --git a/app/users/delete/template.hbs b/app/users/delete/template.hbs index bef8ce7e11..391cd863bb 100644 --- a/app/users/delete/template.hbs +++ b/app/users/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete' name=(concat "the user " model.name)}} + {{t 'messages.delete' name=(concat (t 'models.localizedStrings.user') " " model.name)}}
{{/modal-dialog}} diff --git a/app/visits/delete/template.hbs b/app/visits/delete/template.hbs index e7ed836cd6..cd996fb507 100644 --- a/app/visits/delete/template.hbs +++ b/app/visits/delete/template.hbs @@ -5,7 +5,7 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name='visit'}} + {{t 'messages.delete_singular' name=(t 'models.localizedStrings.visit')}}
diff --git a/app/visits/procedures/delete/template.hbs b/app/visits/procedures/delete/template.hbs index 0de216d3d1..28660b91bd 100644 --- a/app/visits/procedures/delete/template.hbs +++ b/app/visits/procedures/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "messages.delete_singular" name='procedure'}} + {{t "messages.delete_singular" name=(t 'models.localizedStrings.procedure')}}
{{/modal-dialog}} diff --git a/app/visits/vitals/delete/template.hbs b/app/visits/vitals/delete/template.hbs index b0293c2b52..e2cb4f714d 100644 --- a/app/visits/vitals/delete/template.hbs +++ b/app/visits/vitals/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "messages.delete_plural" name='vitals'}} + {{t "messages.delete_plural" name=(t 'models.localizedStrings.vitals')}}
{{/modal-dialog}} diff --git a/tests/acceptance/users-test.js b/tests/acceptance/users-test.js index 2fe3d4e189..8dae8cfcff 100644 --- a/tests/acceptance/users-test.js +++ b/tests/acceptance/users-test.js @@ -166,7 +166,7 @@ test('delete user', function(assert) { click('button:contains(Delete):last'); waitToAppear('.modal-dialog'); andThen(() => { - assert.equal(find('.alert').text().trim(), 'Are you sure you wish to delete the user joe@donuts.com?', 'User is displayed for deletion'); + assert.equal(find('.alert').text().trim(), 'Are you sure you wish to delete user joe@donuts.com?', 'User is displayed for deletion'); }); click('button:contains(Delete):last'); andThen(() => { From 916bbbbfbe16953385874dd8f88ad5edeed2131f Mon Sep 17 00:00:00 2001 From: Bao Chau Date: Fri, 17 Mar 2017 09:26:33 -0700 Subject: [PATCH 3/4] refactor translation file to match model setup --- app/appointments/delete/template.hbs | 2 +- app/imaging/delete/template.hbs | 2 +- app/inc-category/edit/controller.js | 2 +- app/incident/delete/template.hbs | 2 +- app/incident/edit/controller.js | 2 +- app/incident/note/delete/template.hbs | 2 +- app/labs/delete/template.hbs | 2 +- app/locales/en/translations.js | 101 ++++++++++++++++++---- app/medication/delete/template.hbs | 2 +- app/procedures/edit/controller.js | 2 +- app/users/delete/template.hbs | 2 +- app/visits/delete/template.hbs | 2 +- app/visits/procedures/delete/template.hbs | 2 +- app/visits/vitals/delete/template.hbs | 2 +- 14 files changed, 98 insertions(+), 29 deletions(-) diff --git a/app/appointments/delete/template.hbs b/app/appointments/delete/template.hbs index 440d49beaa..16dbd15aef 100644 --- a/app/appointments/delete/template.hbs +++ b/app/appointments/delete/template.hbs @@ -6,6 +6,6 @@
- {{t 'messages.delete_singular' name= (t 'models.localizedStrings.appointment') }} + {{t 'messages.delete_singular' name= (t 'models.appointment.names.singular') }}
{{/modal-dialog}} diff --git a/app/imaging/delete/template.hbs b/app/imaging/delete/template.hbs index ce959e4508..d32e5f252d 100644 --- a/app/imaging/delete/template.hbs +++ b/app/imaging/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name=(t models.localizedStrings.imagingRequest) }} + {{t 'messages.delete_singular' name=(t models.imaging.request.singular) }}
{{/modal-dialog}} diff --git a/app/inc-category/edit/controller.js b/app/inc-category/edit/controller.js index 49dc2b6d2a..fd887cdf29 100644 --- a/app/inc-category/edit/controller.js +++ b/app/inc-category/edit/controller.js @@ -36,7 +36,7 @@ export default AbstractEditController.extend({ showDeleteItem(item) { let i18n = get(this, 'i18n'); - let modelName = i18n.t('models.localizedStrings.item'); + let modelName = i18n.t('models.item.names.singular'); let message = i18n.t('messages.delete_singular', { name: modelName }); let title = i18n.t('incident.titles.deleteItem'); this.displayConfirm(title, message, 'deleteItem', Ember.Object.create({ diff --git a/app/incident/delete/template.hbs b/app/incident/delete/template.hbs index e7fc0d478a..4489e1c5b6 100644 --- a/app/incident/delete/template.hbs +++ b/app/incident/delete/template.hbs @@ -4,6 +4,6 @@ updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'messages.delete_singular' name=(t 'models.localizedStrings.incident')}} + {{t 'messages.delete_singular' name=(t 'models.incident.names.singular')}}
{{/modal-dialog}} diff --git a/app/incident/edit/controller.js b/app/incident/edit/controller.js index 9f9c8113f2..3c33da8306 100644 --- a/app/incident/edit/controller.js +++ b/app/incident/edit/controller.js @@ -205,7 +205,7 @@ export default AbstractEditController.extend(IncidentStatuses, FriendlyId, Patie showDeleteAttachment(attachment) { let i18n = get(this, 'i18n'); - let modelName = i18n.t('models.localizedStrings.attachment'); + let modelName = i18n.t('models.attachment.names.singular'); let message = i18n.t('messages.delete_singular', { name: modelName }); let model = Ember.Object.create({ itemToDelete: attachment diff --git a/app/incident/note/delete/template.hbs b/app/incident/note/delete/template.hbs index 89d6fa8171..4b4f2862a6 100644 --- a/app/incident/note/delete/template.hbs +++ b/app/incident/note/delete/template.hbs @@ -1,6 +1,6 @@ {{#modal-dialog isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
- {{t 'messages.delete_singular' name=(t 'models.localizedStrings.note')}} + {{t 'messages.delete_singular' name=(t 'models.note.names.singular')}}
{{/modal-dialog}} diff --git a/app/labs/delete/template.hbs b/app/labs/delete/template.hbs index 58c4f16024..823a5e2285 100644 --- a/app/labs/delete/template.hbs +++ b/app/labs/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name=(t 'models.localizedStrings.labRequest')}} + {{t 'messages.delete_singular' name=(t 'models.lab.request.singular')}}
{{/modal-dialog}} diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js index 5ee215886c..a264c24633 100644 --- a/app/locales/en/translations.js +++ b/app/locales/en/translations.js @@ -1456,6 +1456,91 @@ export default { type: 'Type', notes: 'Notes', appointmentDate: 'Date' + }, + names: { + singular: 'appointment', + plural: 'appointments' + } + }, + attachment: { + names: { + singular: 'attachment', + plural: 'attachments' + } + }, + form: { + names: { + singular: 'form', + plural: 'forms' + } + }, + incident: { + names: { + singular: 'incident', + plural: 'incidents' + } + }, + item: { + names: { + singular: 'item', + plural: 'items' + } + }, + imaging: { + request: { + singular: 'imaging request', + plural: 'imaging requests' + }, + names: 'imaging' + }, + medication: { + request: { + singular: 'medication request', + plural: 'medication requests' + }, + names: { + singular: 'medication', + plural: 'medications' + } + }, + note: { + names: { + singular: 'note', + plural: 'notes' + } + }, + lab: { + request: { + singular: 'lab request', + plural: 'lab requests' + }, + names: { + singular: 'lab', + plural: 'labs' + } + }, + procedure: { + names: { + singular: 'procedure', + plural: 'procedures' + } + }, + user: { + names: { + singular: 'user', + plural: 'users' + } + }, + visit: { + names: { + singular: 'visit', + plural: 'visits' + } + }, + vital: { + names: { + singular: 'vital', + plural: 'vitals' } }, patient: { @@ -1465,22 +1550,6 @@ export default { names: { singular: 'Patient' } - }, - localizedStrings: { - appointment: 'appointment', - medication: 'medication', - form: 'form', - imagingRequest: 'imaging request', - item: 'item', - incident: 'incident', - attachment: 'attachment', - note: 'note', - labRequest: 'lab request', - medicationRequest: 'medication request', - procedure: 'procedure', - user: 'user', - visit: 'visit', - vitals: 'vitals' } } }; diff --git a/app/medication/delete/template.hbs b/app/medication/delete/template.hbs index c074b16699..83e4a046d2 100644 --- a/app/medication/delete/template.hbs +++ b/app/medication/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name=(t 'models.localizedStrings.medicationRequest')}} + {{t 'messages.delete_singular' name=(t 'models.medication.request.singular')}}
{{/modal-dialog}} diff --git a/app/procedures/edit/controller.js b/app/procedures/edit/controller.js index b9269f5263..5c734addf6 100644 --- a/app/procedures/edit/controller.js +++ b/app/procedures/edit/controller.js @@ -83,7 +83,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { closeModalOnConfirm: false, confirmAction: 'deleteCharge', title: this.get('i18n').t('procedures.titles.deleteMedicationUsed'), - name: this.get('i18n').t('models.localizedStrings.medication'), + name: this.get('i18n').t('models.medication.names.singular'), message: this.get('i18n').t('messages.delete_singular', { name: this.name }), chargeToDelete: charge, updateButtonAction: 'confirm', diff --git a/app/users/delete/template.hbs b/app/users/delete/template.hbs index 391cd863bb..fe36a84408 100644 --- a/app/users/delete/template.hbs +++ b/app/users/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete' name=(concat (t 'models.localizedStrings.user') " " model.name)}} + {{t 'messages.delete' name=(concat (t 'models.user.names.singular') " " model.name)}}
{{/modal-dialog}} diff --git a/app/visits/delete/template.hbs b/app/visits/delete/template.hbs index cd996fb507..b0094bd6af 100644 --- a/app/visits/delete/template.hbs +++ b/app/visits/delete/template.hbs @@ -5,7 +5,7 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete_singular' name=(t 'models.localizedStrings.visit')}} + {{t 'messages.delete_singular' name=(t 'models.visit.names.singular')}}
diff --git a/app/visits/procedures/delete/template.hbs b/app/visits/procedures/delete/template.hbs index 28660b91bd..31093a0dc0 100644 --- a/app/visits/procedures/delete/template.hbs +++ b/app/visits/procedures/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "messages.delete_singular" name=(t 'models.localizedStrings.procedure')}} + {{t "messages.delete_singular" name=(t 'models.procedure.names.singular')}}
{{/modal-dialog}} diff --git a/app/visits/vitals/delete/template.hbs b/app/visits/vitals/delete/template.hbs index e2cb4f714d..5c2f331010 100644 --- a/app/visits/vitals/delete/template.hbs +++ b/app/visits/vitals/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t "messages.delete_plural" name=(t 'models.localizedStrings.vitals')}} + {{t "messages.delete_plural" name=(t 'models.vital.names.plural')}}
{{/modal-dialog}} From a5b3b37fa0e353090a74be3a3ddbf2ec8d62dbd6 Mon Sep 17 00:00:00 2001 From: Bao Chau Date: Mon, 20 Mar 2017 09:37:42 -0700 Subject: [PATCH 4/4] fix minor change in delete message --- app/patients/delete/template.hbs | 2 +- app/users/delete/template.hbs | 2 +- tests/acceptance/users-test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/patients/delete/template.hbs b/app/patients/delete/template.hbs index 1517a943b6..b24642caaa 100644 --- a/app/patients/delete/template.hbs +++ b/app/patients/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete' name=(concat model.firstName " " model.lastName)}} + {{t 'messages.delete' name=model.shortDisplayName}}
{{/modal-dialog}} diff --git a/app/users/delete/template.hbs b/app/users/delete/template.hbs index fe36a84408..dad2024aef 100644 --- a/app/users/delete/template.hbs +++ b/app/users/delete/template.hbs @@ -5,6 +5,6 @@ updateButtonText=updateButtonText }}
- {{t 'messages.delete' name=(concat (t 'models.user.names.singular') " " model.name)}} + {{t 'messages.delete'}}
{{/modal-dialog}} diff --git a/tests/acceptance/users-test.js b/tests/acceptance/users-test.js index 8dae8cfcff..da8984d9f5 100644 --- a/tests/acceptance/users-test.js +++ b/tests/acceptance/users-test.js @@ -166,7 +166,7 @@ test('delete user', function(assert) { click('button:contains(Delete):last'); waitToAppear('.modal-dialog'); andThen(() => { - assert.equal(find('.alert').text().trim(), 'Are you sure you wish to delete user joe@donuts.com?', 'User is displayed for deletion'); + assert.equal(find('.alert').text().trim(), 'Are you sure you wish to delete ?', 'User is displayed for deletion'); }); click('button:contains(Delete):last'); andThen(() => {