From 59870df9151ad9cc2a9ea66a23f66bd9f5e49a69 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 22 Sep 2020 15:19:47 -0400 Subject: [PATCH] refactor: separate error translations into separate file --- ui/core/app/components/error/message.hbs | 8 ++++++-- .../scopes/scope/authenticate/method.js | 2 +- ui/core/app/templates/scopes/scope/error.hbs | 5 +++-- ui/core/config/ember-intl.js | 2 +- ui/core/translations/en-us.yaml | 19 ------------------- ui/core/translations/errors/en-us.yaml | 19 +++++++++++++++++++ 6 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 ui/core/translations/errors/en-us.yaml diff --git a/ui/core/app/components/error/message.hbs b/ui/core/app/components/error/message.hbs index 90c471554..afcf013d9 100644 --- a/ui/core/app/components/error/message.hbs +++ b/ui/core/app/components/error/message.hbs @@ -1,6 +1,10 @@ - + {{t (concat "errors." this.messageCode ".description")}} {{#if this.helpRoute}} {{t "actions.help"}} {{/if}} - \ No newline at end of file + diff --git a/ui/core/app/routes/scopes/scope/authenticate/method.js b/ui/core/app/routes/scopes/scope/authenticate/method.js index ed1ebc026..7a0ce5580 100644 --- a/ui/core/app/routes/scopes/scope/authenticate/method.js +++ b/ui/core/app/routes/scopes/scope/authenticate/method.js @@ -57,7 +57,7 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route { this.transitionTo('scopes.scope.projects'); } } catch (e) { - const errorMessage = this.intl.t('errors.titles.authentication-failed'); + const errorMessage = this.intl.t('errors.authentication-failed.title'); this.notify.error(errorMessage, { closeAfter: null }); } } diff --git a/ui/core/app/templates/scopes/scope/error.hbs b/ui/core/app/templates/scopes/scope/error.hbs index 8d56c81ce..70b0ce6ad 100644 --- a/ui/core/app/templates/scopes/scope/error.hbs +++ b/ui/core/app/templates/scopes/scope/error.hbs @@ -1,6 +1,7 @@ -{{title (t "errors.titles.error") }} +{{title (t "errors.generic.title") }} + {{#each @model.errors as |error|}} {{/each}} - \ No newline at end of file + diff --git a/ui/core/config/ember-intl.js b/ui/core/config/ember-intl.js index 120cf447e..783bb4032 100644 --- a/ui/core/config/ember-intl.js +++ b/ui/core/config/ember-intl.js @@ -47,7 +47,7 @@ module.exports = function (/* environment */) { * @type {Boolean} * @default "false" */ - wrapTranslationsWithNamespace: false, + wrapTranslationsWithNamespace: true, /** * Cause a build error if ICU argument mismatches are detected. diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 4c044bb2f..df04fe907 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -191,25 +191,6 @@ form: new_password: New Password started: Started status: Status -errors: - 401: - title: You are not signed in - description: You are not authenticated. Please authenticate and try again later. - 403: - title: You are not authorized - description: You must be granted permissions to view this data. Ask your administrator if you think you should have access. - 404: - title: Resource not found - description: We could not find the requested resource. You can ask your administrator or try again later. - 500: - title: Server error - description: We ran into a problem and could not continue. You can ask your administrator or try again later. - unknown: - title: Something went wrong - description: Please contact your administrator or try again later. - titles: - authentication-failed: Authentication Failed - error: Error notify: create-success: Created succesfully. save-success: Saved succesfully. diff --git a/ui/core/translations/errors/en-us.yaml b/ui/core/translations/errors/en-us.yaml new file mode 100644 index 000000000..0e2239e72 --- /dev/null +++ b/ui/core/translations/errors/en-us.yaml @@ -0,0 +1,19 @@ +401: + title: You are not signed in + description: You are not authenticated. Please authenticate and try again later. +403: + title: You are not authorized + description: You must be granted permissions to view this data. Ask your administrator if you think you should have access. +404: + title: Resource not found + description: We could not find the requested resource. You can ask your administrator or try again later. +500: + title: Server error + description: We ran into a problem and could not continue. You can ask your administrator or try again later. +unknown: + title: Something went wrong + description: Please contact your administrator or try again later. +generic: + title: Error +authentication-failed: + title: Authentication Failed