From 547b5fc35b0f658f88414f8628f668af89f62734 Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Mon, 24 Feb 2020 15:42:40 -0800 Subject: Update language json structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restructure language file to use consistent pattern across pages following loose guidelines. - Create buckets for common global labels - Create common component objects–appHeader, appNavigation, appPageTitle - Page specific labels should be nested in an object with a key prefixed with 'page' followed by the page title - Any 'major' child components should be nested inside page specific objects - Avoid any complex linked locale messages - Alphabetize object keys, alphabetize nested properties at end of object block Signed-off-by: Yoshie Muranaka Change-Id: Ie4222b3ce24dec7af31b55b5a77425ca2f492789 --- src/components/Global/InputPasswordToggle.vue | 2 +- src/components/Global/TableToolbar.vue | 4 +- src/components/Mixins/BVToastMixin.js | 6 +- src/locales/en.json | 164 ++++++++++----------- src/locales/es.json | 45 +++--- src/router/index.js | 12 +- .../AccessControl/LocalUserMangementStore.js | 18 +-- src/store/modules/Control/ControlStore.js | 6 +- .../LocalUserManagement/LocalUserManagement.vue | 6 +- .../LocalUserManagement/ModalSettings.vue | 28 ++-- src/views/Control/RebootBmc/RebootBmc.vue | 2 +- src/views/Login/Login.vue | 22 +-- src/views/Overview/Overview.vue | 38 ++--- src/views/Overview/OverviewEvents.vue | 12 +- src/views/Overview/OverviewNetwork.vue | 8 +- src/views/Overview/OverviewQuickLinks.vue | 12 +- 16 files changed, 182 insertions(+), 203 deletions(-) diff --git a/src/components/Global/InputPasswordToggle.vue b/src/components/Global/InputPasswordToggle.vue index 8c522525..3199cab3 100644 --- a/src/components/Global/InputPasswordToggle.vue +++ b/src/components/Global/InputPasswordToggle.vue @@ -2,7 +2,7 @@

- {{ selectedItemsCount }} {{ $t('global.actions.selected') }} + {{ selectedItemsCount }} {{ $t('global.action.selected') }}

- {{ $t('global.actions.cancel') }} + {{ $t('global.action.cancel') }}
diff --git a/src/components/Mixins/BVToastMixin.js b/src/components/Mixins/BVToastMixin.js index a46f5e50..4fedc9a4 100644 --- a/src/components/Mixins/BVToastMixin.js +++ b/src/components/Mixins/BVToastMixin.js @@ -2,7 +2,7 @@ import i18n from '../../i18n'; const BVToastMixin = { methods: { - successToast(message, title = i18n.t('global.response.success')) { + successToast(message, title = i18n.t('global.status.success')) { this.$root.$bvToast.toast(message, { title, variant: 'success', @@ -11,7 +11,7 @@ const BVToastMixin = { solid: true }); }, - errorToast(message, title = i18n.t('global.response.error')) { + errorToast(message, title = i18n.t('global.status.error')) { this.$root.$bvToast.toast(message, { title, variant: 'danger', @@ -20,7 +20,7 @@ const BVToastMixin = { solid: true }); }, - warningToast(message, title = i18n.t('global.response.warning')) { + warningToast(message, title = i18n.t('global.status.warning')) { this.$root.$bvToast.toast(message, { title, variant: 'warning', diff --git a/src/locales/en.json b/src/locales/en.json index f392f4e8..c94e194a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1,91 +1,114 @@ { "global": { - "formField": { - "fieldRequired": "Field required", - "valueMustBeBetween": "Value must be between %{min} – %{max}", - "mustBeAtLeast": "Must be at least %{value}" - }, - "on": "on", - "off": "off", - "state": { - "notAvailable": "Not available", - "notEnabled": "Not enabled" - }, - "actions": { + "action": { "confirm": "Confirm", "cancel": "Cancel", "delete": "Delete", + "disable": "Disable", + "enable": "Enable", "save": "Save", "selected": "Selected" }, - "response": { - "success": "Success", + "ariaLabel": { + "showPassword": "Show password as plain text. Note: this will visually expose your password on the screen." + }, + "form": { + "fieldRequired": "Field required", + "mustBeAtLeast": "Must be at least %{value}", + "selectAnOption": "Select an option", + "valueMustBeBetween": "Value must be between %{min} – %{max}" + }, + "status": { + "disabled": "Disabled", + "enabled": "Enabled", "error": "Error", + "notAvailable": "Not available", + "off": "Off", + "on": "On", + "success": "Success", "warning": "Warning" } }, - "ariaLabels": { - "showPassword": "Show password as plain text. Note: this will visually expose your password on the screen." + "appHeader": { + "health": "Health", + "logOut": "Log out", + "power": "Power", + "refresh": "Refresh" }, - "pageTitle": { - "localUserMgmt": "Local user management", + "appNavigation": { + "accessControl": "Access Control", + "configuration": "Configuration", + "control": "Control", + "health": "Health", + "localUserManagement": "@appPageTitle.localUserManagement", + "overview": "@appPageTitle.overview", + "rebootBmc": "@appPageTitle.rebootBmc" + }, + "appPageTitle": { + "localUserManagement": "Local user management", "login": "Login", "overview": "Overview", "unauthorized": "Unauthorized", "rebootBmc": "Reboot BMC" }, - "login": { - "language": { - "label": "Language" - }, - "languages": { - "select": "Select an option", - "english": "English", - "spanish": "Spanish" - }, - "logIn": { - "label": "Log in" + "pageLocalUserManagement": { + "accountPolicySettings": "Account policy settings", + "modal": { + "automaticAfterTimeout": "Automatic after timeout", + "manual": "Manual", + "maxFailedLoginAttempts": "Max failed login attempts", + "timeoutDurationSeconds": "Timeout duration (seconds)", + "userUnlockMethod": "User unlock method" }, - "errorMsg": { + "toast": { + "errorDeleteUsers": "Error deleting %{count} user. | Error deleting %{count} users.", + "errorDisableUsers": "Error disabling %{count} user. | Error disabling %{count} users.", + "errorEnableUsers": "Error enabling %{count} user. | Error enabling %{count} users.", + "errorSaveSettings": "Error saving account settings.", + "successDeleteUsers": "Successfully deleted %{count} user. | Successfully deleted %{count} users.", + "successDisableUsers": "Successfully disabled %{count} user. | Successfully disabled %{count} users.", + "successEnableUsers": "Successfully enabled %{count} user. | Successfully enabled %{count} users.", + "successSaveSettings": "Successfully saved account settings." + } + }, + "pageLogin": { + "language": "Language", + "logIn": "Log in", + "password": "Password", + "username": "Username", + "alert": { "title": "Invalid username or password.", "action": "Please try again." }, - "password": { - "label": "Password", - "validator": "@:global.formField.fieldRequired" - }, - "username": { - "label": "Username", - "validator": "@:global.formField.fieldRequired" + "form": { + "english": "English", + "spanish": "Spanish" } }, - "overview": { + "pageOverview": { + "bmcInformation": "BMC information", + "firmwareVersion": "Firmware version", + "highPriorityEvents": "High priority events", + "manufacturer": "Manufacturer", + "model": "Model", + "networkInformation": "Network information", + "powerCap": "Power cap", + "powerConsumption": "Power consumption", + "serialNumber": "Serial number", + "serverInformation": "Server information", "events": { - "noHighEventsMsg": "There are no high priority events to display at this time.", "date": "Date", "description": "Description", "id": "ID", + "noHighEventsMsg": "There are no high priority events to display at this time.", "refCode": "Reference code", "viewAllButton": "View all event logs" }, - "firmwareVersion": "Firmware version", - "manufacturer": "Manufacturer", - "model": "Model", "network": { "hostname": "Hostname", "ipAddress": "IP address", "macAddress": "MAC address" }, - "powerCap": "Power cap", - "powerConsumption": "Power consumption", - "sectionTitle": { - "bmcInformation": "BMC information", - "highPriorityEvents": "High priority events", - "networkInformation": "Network information", - "powerConsumption": "@:overview.powerConsumption", - "serverInformation": "Server information" - }, - "serialNumber": "Serial number", "quicklinks": { "bmcTime": "BMC time", "editNetworkSettings": "Edit network settings", @@ -94,40 +117,15 @@ } }, "pageRebootBmc": { - "rebootInformation": "When you reboot the BMC, your web browser loses contact with the BMC for several minutes. When the BMC is back online, you may need to log in again.", "rebootBmc": "Reboot BMC", + "rebootInformation": "When you reboot the BMC, your web browser loses contact with the BMC for several minutes. When the BMC is back online, you may need to log in again.", "modal": { - "confirmTitle": "Confirm BMC reboot", - "confirmMessage": "Are you sure you want to reboot the BMC?" + "confirmMessage": "Are you sure you want to reboot the BMC?", + "confirmTitle": "Confirm BMC reboot" }, - "toastMessages": { - "successRebootStart": "Rebooting BMC.", - "errorRebootStart": "Error rebooting BMC." - } - }, - "localUserManagement": { - "accountPolicySettings": "Account policy settings", - "tableActions": { - "delete": "@:global.actions.delete", - "enable": "Enable", - "disable": "Disable" - }, - "toastMessages": { - "successDeleteUsers": "Successfully deleted %{count} user. | Successfully deleted %{count} users.", - "errorDeleteUsers": "Error deleting %{count} user. | Error deleting %{count} users.", - "successEnableUsers": "Successfully enabled %{count} user. | Successfully enabled %{count} users.", - "errorEnableUsers": "Error enabling %{count} user. | Error enabling %{count} users.", - "successDisableUsers": "Successfully disabled %{count} user. | Successfully disabled %{count} users.", - "errorDisableUsers": "Error disabling %{count} user. | Error disabling %{count} users.", - "successSaveSettings": "Successfully saved account settings.", - "errorSaveSettings": "Error saving account settings." - }, - "modals": { - "manual": "Manual", - "automaticAfterTimeout": "Automatic after timeout", - "timeoutDurationSeconds": "Timeout duration (seconds)", - "maxFailedLoginAttempts": "Max failed login attempts", - "userUnlockMethod": "User unlock method" + "toast": { + "errorRebootStart": "Error rebooting BMC.", + "successRebootStart": "Rebooting BMC." } } } \ No newline at end of file diff --git a/src/locales/es.json b/src/locales/es.json index 30d1fd17..48ed7748 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1,38 +1,27 @@ { "global": { - "formField": { - "validator": "Campo requerido" + "form": { + "fieldRequired": "Campo requerido" } }, - "login": { - "language": { - "label": "Idioma" - }, - "languages": { - "select": "Seleccione una opción", - "english": "Inglés", - "spanish": "Español" - }, - "logIn": { - "label": "Iniciar sesión" - }, - "errorMsg": { - "title": "Usuario o contraseña invalido.", - "action": "Inténtalo de nuevo." - }, - "password": { - "label": "Contraseña", - "validator": "@:global.formField.validator" - }, - "username": { - "label": "Nombre de usuario", - "validator": "@:global.formField.validator" - } - }, - "pageTitle": { + "appPageTitle": { "localUserMgmt": "Administración de usuarios locales", "login": "Inicio de sesión", "overview": "Información general", "unauthorized": "No autorizado" + }, + "pageLogin": { + "language": "Idioma", + "logIn": "Iniciar sesión", + "password": "Contraseña", + "username": "Nombre de usuario", + "alert": { + "title": "Usuario o contraseña invalido.", + "action": "Inténtalo de nuevo." + }, + "form": { + "english": "Inglés", + "spanish": "Español" + } } } \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 9a30e976..dda4daf5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,7 +6,7 @@ import AppLayout from '../layouts/AppLayout.vue'; Vue.use(VueRouter); // Meta title is translated using i18n in App.vue and PageTitle.Vue -// Example meta: {title: 'pageTitle.overview'} +// Example meta: {title: 'appPageTitle.overview'} const routes = [ { path: '/', @@ -20,7 +20,7 @@ const routes = [ path: '', component: () => import('@/views/Overview'), meta: { - title: 'pageTitle.overview' + title: 'appPageTitle.overview' } }, { @@ -28,7 +28,7 @@ const routes = [ name: 'local-users', component: () => import('@/views/AccessControl/LocalUserManagement'), meta: { - title: 'pageTitle.localUserMgmt' + title: 'appPageTitle.localUserManagement' } }, { @@ -36,7 +36,7 @@ const routes = [ name: 'reboot-bmc', component: () => import('@/views/Control/RebootBmc'), meta: { - title: 'pageTitle.rebootBmc' + title: 'appPageTitle.rebootBmc' } }, { @@ -44,7 +44,7 @@ const routes = [ name: 'unauthorized', component: () => import('@/views/Unauthorized'), meta: { - title: 'pageTitle.unauthorized' + title: 'appPageTitle.unauthorized' } } ] @@ -54,7 +54,7 @@ const routes = [ name: 'login', component: () => import('@/views/Login'), meta: { - title: 'pageTitle.login' + title: 'appPageTitle.login' } } ]; diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js index 7ad3ff50..ab314fb8 100644 --- a/src/store/modules/AccessControl/LocalUserMangementStore.js +++ b/src/store/modules/AccessControl/LocalUserMangementStore.js @@ -154,7 +154,7 @@ const LocalUserManagementStore = { if (successCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.successDeleteUsers', + 'pageLocalUserManagement.toast.successDeleteUsers', successCount ); toastMessages.push({ type: 'success', message }); @@ -162,7 +162,7 @@ const LocalUserManagementStore = { if (errorCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.errorDeleteUsers', + 'pageLocalUserManagement.toast.errorDeleteUsers', errorCount ); toastMessages.push({ type: 'error', message }); @@ -197,7 +197,7 @@ const LocalUserManagementStore = { if (successCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.successEnableUsers', + 'pageLocalUserManagement.toast.successEnableUsers', successCount ); toastMessages.push({ type: 'success', message }); @@ -205,7 +205,7 @@ const LocalUserManagementStore = { if (errorCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.errorEnableUsers', + 'pageLocalUserManagement.toast.errorEnableUsers', errorCount ); toastMessages.push({ type: 'error', message }); @@ -240,7 +240,7 @@ const LocalUserManagementStore = { if (successCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.successDisableUsers', + 'pageLocalUserManagement.toast.successDisableUsers', successCount ); toastMessages.push({ type: 'success', message }); @@ -248,7 +248,7 @@ const LocalUserManagementStore = { if (errorCount) { const message = i18n.tc( - 'localUserManagement.toastMessages.errorDisableUsers', + 'pageLocalUserManagement.toast.errorDisableUsers', errorCount ); toastMessages.push({ type: 'error', message }); @@ -274,13 +274,11 @@ const LocalUserManagementStore = { .patch('/redfish/v1/AccountService', data) //GET new settings to update view .then(() => dispatch('getAccountSettings')) - .then(() => - i18n.t('localUserManagement.toastMessages.successSaveSettings') - ) + .then(() => i18n.t('pageLocalUserManagement.toast.successSaveSettings')) .catch(error => { console.log(error); const message = i18n.t( - 'localUserManagement.toastMessages.errorSaveSettings' + 'pageLocalUserManagement.toast.errorSaveSettings' ); throw new Error(message); }); diff --git a/src/store/modules/Control/ControlStore.js b/src/store/modules/Control/ControlStore.js index f6415771..9b2e4592 100644 --- a/src/store/modules/Control/ControlStore.js +++ b/src/store/modules/Control/ControlStore.js @@ -8,12 +8,10 @@ const ControlStore = { const data = { ResetType: 'GracefulRestart' }; return await api .post('/redfish/v1/Managers/bmc/Actions/Manager.Reset', data) - .then(() => i18n.t('pageRebootBmc.toastMessages.successRebootStart')) + .then(() => i18n.t('pageRebootBmc.toast.successRebootStart')) .catch(error => { console.log(error); - throw new Error( - i18n.t('pageRebootBmc.toastMessages.errorRebootStart') - ); + throw new Error(i18n.t('pageRebootBmc.toast.errorRebootStart')); }); } } diff --git a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue index ee2ec433..7b337a4f 100644 --- a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue +++ b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue @@ -139,15 +139,15 @@ export default { tableToolbarActions: [ { value: 'delete', - labelKey: 'localUserManagement.tableActions.delete' + labelKey: 'global.action.delete' }, { value: 'enable', - labelKey: 'localUserManagement.tableActions.enable' + labelKey: 'global.action.enable' }, { value: 'disable', - labelKey: 'localUserManagement.tableActions.disable' + labelKey: 'global.action.disable' } ] }; diff --git a/src/views/AccessControl/LocalUserManagement/ModalSettings.vue b/src/views/AccessControl/LocalUserManagement/ModalSettings.vue index 2e41b292..650cd560 100644 --- a/src/views/AccessControl/LocalUserManagement/ModalSettings.vue +++ b/src/views/AccessControl/LocalUserManagement/ModalSettings.vue @@ -2,8 +2,8 @@ @@ -12,12 +12,14 @@ {{ - $t('global.formField.valueMustBeBetween', { + $t('global.form.valueMustBeBetween', { min: 0, max: 65535 }) @@ -33,7 +35,7 @@ />