From 77cecdb98a5b8c3502839ccbb5c711bdd7879318 Mon Sep 17 00:00:00 2001 From: Darin Swanson Date: Mon, 14 Mar 2016 14:29:19 -0700 Subject: [PATCH] address and loaddb localization changes #345 --- app/admin/address/route.js | 7 ++++--- app/admin/loaddb/controller.js | 15 +++++++++++---- app/admin/loaddb/route.js | 3 ++- app/locales/en/translations.js | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/app/admin/address/route.js b/app/admin/address/route.js index 8a2a477eac..66c3251c90 100644 --- a/app/admin/address/route.js +++ b/app/admin/address/route.js @@ -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) { @@ -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 } })); diff --git a/app/admin/loaddb/controller.js b/app/admin/loaddb/controller.js index 839527dbd4..d5dd5f6294 100644 --- a/app/admin/loaddb/controller.js +++ b/app/admin/loaddb/controller.js @@ -1,11 +1,12 @@ 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: { @@ -13,7 +14,10 @@ export default Ember.Controller.extend(ModalHelper, ProgressDialog, { 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'); @@ -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) }) + ); }); }); } diff --git a/app/admin/loaddb/route.js b/app/admin/loaddb/route.js index 50ab10091d..8a2f36fc60 100644 --- a/app/admin/loaddb/route.js +++ b/app/admin/loaddb/route.js @@ -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')) { diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js index 4e73eb5137..c39f898dbf 100644 --- a/app/locales/en/translations.js +++ b/app/locales/en/translations.js @@ -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: {