Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Refactor delete message translation (#992)
Browse files Browse the repository at this point in the history
* refactor delete message in translation model. make changes where delete messages are called

* replace non-localized with localized strings. add localizedStrings under models translation file.

* refactor translation file to match model setup

* fix minor change in delete message
  • Loading branch information
baoqchau authored and jkleinsc committed Mar 20, 2017
1 parent 89d6b90 commit be4cca9
Show file tree
Hide file tree
Showing 22 changed files with 115 additions and 46 deletions.
2 changes: 1 addition & 1 deletion app/admin/custom-forms/index/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export default AbstractIndexRoute.extend(ModalHelper, UserSession, {
actions: {
deleteItem(item) {
let i18n = this.get('i18n');
let message = i18n.t('admin.customForms.messages.deleteForm');
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);
},
Expand Down
2 changes: 1 addition & 1 deletion app/admin/lookup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', { name: value });
this.displayConfirm(title, message, 'deleteValue', Ember.Object.create({
valueToDelete: value
}));
Expand Down
3 changes: 2 additions & 1 deletion app/appointments/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'appointments.messages.deleteAppointmentMessage'}}

{{t 'messages.delete_singular' name= (t 'models.appointment.names.singular') }}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/imaging/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'imaging.messages.delete'}}
{{t 'messages.delete_singular' name=(t models.imaging.request.singular) }}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/inc-category/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'incident.messages.deleteCategory' name=model.incidentCategoryName}}
{{t 'messages.delete' name=model.incidentCategoryName}}
</div>
{{/modal-dialog}}
3 changes: 2 additions & 1 deletion app/inc-category/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default AbstractEditController.extend({

showDeleteItem(item) {
let i18n = get(this, 'i18n');
let message = i18n.t('incident.messages.deleteItem');
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({
itemToDelete: item
Expand Down
2 changes: 1 addition & 1 deletion app/incident/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
updateButtonAction=updateButtonAction
updateButtonText=updateButtonText}}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span> {{t 'incident.messages.deleteIncident' name=name}}
<span class="glyphicon glyphicon-warning-sign"></span> {{t 'messages.delete_singular' name=(t 'models.incident.names.singular')}}
</div>
{{/modal-dialog}}
3 changes: 2 additions & 1 deletion app/incident/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ export default AbstractEditController.extend(IncidentStatuses, FriendlyId, Patie

showDeleteAttachment(attachment) {
let i18n = get(this, 'i18n');
let message = i18n.t('incident.messages.deleteAttachment');
let modelName = i18n.t('models.attachment.names.singular');
let message = i18n.t('messages.delete_singular', { name: modelName });
let model = Ember.Object.create({
itemToDelete: attachment
});
Expand Down
2 changes: 1 addition & 1 deletion app/incident/note/delete/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#modal-dialog isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction updateButtonText=updateButtonText}}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'incident.messages.deleteNote'}}
{{t 'messages.delete_singular' name=(t 'models.note.names.singular')}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/inventory/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>&nbsp;
{{t 'inventory.messages.delete' name=model.name}}
{{t 'messages.delete' name=model.name}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/invoices/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
{{#em-form model=model submitButton=false }}{{/em-form}}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'billing.alerts.deleteItem' item=model.displayInvoiceNumber}}
{{t 'messages.delete' name=model.displayInvoiceNumber}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/labs/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'labs.messages.confirmDeletion'}}
{{t 'messages.delete_singular' name=(t 'models.lab.request.singular')}}
</div>
{{/modal-dialog}}
115 changes: 90 additions & 25 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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'
}
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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 <strong>{{item}}</strong> could not be found.<br>If you would like to create a new inventory item, fill in the information below.<br>Otherwise, press the Cancel button to return.',
loading: 'Loading transactions ...',
purchaseSaved: 'The inventory purchases have been successfully saved.',
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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.',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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: {
Expand All @@ -926,9 +915,6 @@ export default {
}
},
vitals: {
messages: {
delete: 'Are you sure you wish to delete these vitals?'
},
labels: {
dateRecorded: 'Date Recorded',
temperature: 'Temperature',
Expand All @@ -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.',
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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 <strong>{{patientFullName}}</strong> 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.',
Expand Down Expand Up @@ -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.'
},
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -1476,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: {
Expand Down
2 changes: 1 addition & 1 deletion app/medication/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'medication.messages.confirmDeletion'}}
{{t 'messages.delete_singular' name=(t 'models.medication.request.singular')}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/patients/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'patients.messages.deletePatient' firstName=model.firstName lastName=model.lastName}}
{{t 'messages.delete' name=model.shortDisplayName}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/pricing/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'billing.alerts.deleteItem' item=model.name}}
{{t 'messages.delete' name=model.name}}
</div>
{{/modal-dialog}}
3 changes: 2 additions & 1 deletion app/procedures/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('procedures.messages.deleteMedication'),
name: this.get('i18n').t('models.medication.names.singular'),
message: this.get('i18n').t('messages.delete_singular', { name: this.name }),
chargeToDelete: charge,
updateButtonAction: 'confirm',
updateButtonText: this.get('i18n').t('buttons.ok')
Expand Down
2 changes: 1 addition & 1 deletion app/users/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'messages.areYouSureDelete' user=model.name}}
{{t 'messages.delete'}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/visits/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t 'visits.messages.delete'}}
{{t 'messages.delete_singular' name=(t 'models.visit.names.singular')}}
</div>
<form role="form">
<div class="form-group">
Expand Down
2 changes: 1 addition & 1 deletion app/visits/procedures/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t "procedures.messages.delete"}}
{{t "messages.delete_singular" name=(t 'models.procedure.names.singular')}}
</div>
{{/modal-dialog}}
2 changes: 1 addition & 1 deletion app/visits/vitals/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
{{t "vitals.messages.delete"}}
{{t "messages.delete_plural" name=(t 'models.vital.names.plural')}}
</div>
{{/modal-dialog}}
Loading

0 comments on commit be4cca9

Please sign in to comment.