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

Commit

Permalink
address and loaddb localization changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Darin Swanson committed Mar 14, 2016
1 parent 2a64b90 commit 77cecdb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
7 changes: 4 additions & 3 deletions app/admin/address/route.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
export default AbstractEditRoute.extend({
hideNewButton: true,
newTitle: 'Address Options',
editTitle: 'Address Options',
newTitle: t('admin.address.route.new_title'),
editTitle: t('admin.address.route.edit_title'),
model: function() {
return new Ember.RSVP.Promise(function(resolve) {
this.get('store').find('option', 'address_options').then(function(addressOptions) {
Expand All @@ -13,7 +14,7 @@ export default AbstractEditRoute.extend({
var newConfig = store.push(store.normalize('option', {
id: 'address_options',
value: {
address1Label: 'Address',
address1Label: this.get('i18n').t('admin.address.route.address1_label'),
address1Include: true
}
}));
Expand Down
15 changes: 11 additions & 4 deletions app/admin/loaddb/controller.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
import ModalHelper from 'hospitalrun/mixins/modal-helper';
import ProgressDialog from 'hospitalrun/mixins/progress-dialog';
export default Ember.Controller.extend(ModalHelper, ProgressDialog, {
database: Ember.inject.service(),
fileSystem: Ember.inject.service('filesystem'),
progressMessage: 'Please wait while your database is loaded.',
progressTitle: 'Loading Database',
progressMessage: t('admin.loaddb.controller.progress_message'),
progressTitle: t('admin.loaddb.controller.progress_title'),
syncResults: null,

actions: {
loadFile: function() {
var fileSystem = this.get('fileSystem'),
fileToImport = this.get('importFile');
if (!fileToImport || !fileToImport.type) {
this.displayAlert('Select File To Load', 'Please select file to load.');
this.displayAlert(
this.get('i18n').t('admin.loaddb.controller.display_alert_title'),
this.get('i18n').t('admin.loaddb.controller.display_alert_message')
);
} else {
this.showProgressModal();
this.set('syncResults');
Expand All @@ -25,7 +29,10 @@ export default Ember.Controller.extend(ModalHelper, ProgressDialog, {
this.closeProgressModal();
this.set('syncResults', results);
}).catch((err) => {
this.displayAlert('Error Loading', `The database could not be imported. The error was:${JSON.stringify(err)}`);
this.displayAlert(
this.get('i18n').t('admin.loaddb.controller.error_display_alert_title'),
this.get('i18n').t('admin.loaddb.controller.error_display_alert_message', { error: JSON.stringify(err) })
);
});
});
}
Expand Down
3 changes: 2 additions & 1 deletion app/admin/loaddb/route.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
import UserSession from 'hospitalrun/mixins/user-session';
export default AbstractEditRoute.extend(UserSession, {
hideNewButton: true,
editTitle: 'Load DB',
editTitle: t('admin.loaddb.route.edit_title'),

beforeModel: function() {
if (!this.currentUserCan('load_db')) {
Expand Down
18 changes: 18 additions & 0 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ export default {
},
messages: {
address_saved: 'The address options have been saved'
},
route: {
new_title: 'Address Options',
edit_title: 'Address Options',
address1_label: 'Address'
}
},
loaddb: {
controller: {
progress_message: 'Please wait while your database is loaded.',
progress_title: 'Loading Database',
display_alert_title: 'Select File To Load',
display_alert_message: 'Please select file to load.',
error_display_alert_title: 'Error Loading',
error_display_alert_message: `The database could not be imported. The error was: {{error}}`
},
route: {
edit_title: 'Load DB'
}
},
lookup: {
Expand Down

0 comments on commit 77cecdb

Please sign in to comment.