-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Refactor delete message translation #992
Refactor delete message translation #992
Conversation
228a748
to
24665f1
Compare
…te messages are called
@@ -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' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/admin/lookup/controller.js
Outdated
@@ -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') }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/appointments/delete/template.hbs
Outdated
@@ -5,6 +5,6 @@ | |||
updateButtonText=updateButtonText }} | |||
<div class="alert alert-danger"> | |||
<span class="glyphicon glyphicon-warning-sign"></span> | |||
{{t 'appointments.messages.deleteAppointmentMessage'}} | |||
{{t 'messages.delete_singular' name='appointment'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baoqchau thanks for the PR! It looks like most of the changes you have made are passing a non localized string to i18n.t (eg passing in the word 'form'). You need to either change those to use a localized string (eg localized version of 'form' or pass in the name of the item you are deleting.
delete: 'Are you sure you wish to delete {{name}}?'
Should be used when passing in a name
and when using
delete_singular: 'Are you sure you wish to delete this{{name}}?'
delete_plural: 'Are you sure you wish to delete {{name}}?'
You need to pass in a localized value for name.
app/imaging/delete/template.hbs
Outdated
@@ -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='imaging request' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
@@ -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}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is using an item name and is done correctly
app/inc-category/edit/controller.js
Outdated
@@ -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' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/incident/delete/template.hbs
Outdated
@@ -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='incident'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/incident/edit/controller.js
Outdated
@@ -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' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/procedures/edit/controller.js
Outdated
@@ -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' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/users/delete/template.hbs
Outdated
@@ -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' name=(concat "the user " model.name)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
app/visits/delete/template.hbs
Outdated
@@ -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='visit'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
@@ -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='procedure'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
@@ -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='vitals'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is passing a non localized string when it should be passing in a localized string or it should use the name of the item being deleted.
…der models translation file.
@jkleinsc Is this better? I put all the terms under the "models" in the translation file. |
@baoqchau Those terms should be under the models section, but they need to follow the structure documented in #547. For example instead of: models: {
....
localizedStrings: {
appointment: 'appointment'
....
}
} it should instead be: models: {
appointment: {
labels: {
...
},
names: {
singular: 'appointment'
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baoqchau looks good except for a couple of small changes I commented on. Once those are made, we should be able to merge this in.
app/patients/delete/template.hbs
Outdated
@@ -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=(concat model.firstName " " model.lastName)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should user model.shortDisplayName instead of concatenating first and lastName
app/users/delete/template.hbs
Outdated
@@ -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' name=(concat (t 'models.user.names.singular') " " model.name)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use concat here because the order could be different in different languages. For user I think it would be fine to have the message be:
Are you sure you wish to delete
so you can drop the
(concat (t 'models.user.names.singular') " "
oh man this is awesome thank you @baoqchau |
Fixes #543.
Changes proposed in this pull request:
cc @HospitalRun/core-maintainers