From 67f90f852161cca146d55eb8a057b29b60df32ce Mon Sep 17 00:00:00 2001 From: jathushan-r Date: Thu, 21 Mar 2024 07:44:19 +0530 Subject: [PATCH 1/2] separate i18n consoleSettings namespace --- .../administrators-list.tsx | 12 ++-- ...e-console-role-wizard-permissions-form.tsx | 12 ++-- .../components/console-settings-tabs.tsx | 8 +-- .../pages/console-administrator-edit-page.tsx | 2 +- apps/console/src/features/core/configs/app.ts | 3 +- .../features/core/constants/i18n-constants.ts | 31 +--------- .../i18n/src/models/namespaces/console-ns.ts | 36 ----------- .../models/namespaces/console-settings-ns.ts | 53 ++++++++++++++++ modules/i18n/src/models/namespaces/index.ts | 3 +- modules/i18n/src/translations/en-US/meta.ts | 5 +- .../en-US/portals/console-settings.ts | 61 +++++++++++++++++++ .../src/translations/en-US/portals/console.ts | 36 ----------- .../src/translations/en-US/portals/index.ts | 3 +- 13 files changed, 143 insertions(+), 122 deletions(-) create mode 100644 modules/i18n/src/models/namespaces/console-settings-ns.ts create mode 100644 modules/i18n/src/translations/en-US/portals/console-settings.ts diff --git a/apps/console/src/features/console-settings/components/console-administrators/administrators-list/administrators-list.tsx b/apps/console/src/features/console-settings/components/console-administrators/administrators-list/administrators-list.tsx index 1b4ce392111..4ce852c3edd 100644 --- a/apps/console/src/features/console-settings/components/console-administrators/administrators-list/administrators-list.tsx +++ b/apps/console/src/features/console-settings/components/console-administrators/administrators-list/administrators-list.tsx @@ -24,14 +24,13 @@ import { } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; import { EmptyPlaceholder, ListLayout, PrimaryButton } from "@wso2is/react-components"; -import { UsersConstants } from "../../../../../extensions/components/users/constants/users"; -import { UserStoreDropdownItem } from "../../../../userstores/models"; import React, { ReactElement, useState } from "react"; import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; import { Dispatch } from "redux"; import { Dropdown, DropdownItemProps, DropdownProps, Icon, PaginationProps } from "semantic-ui-react"; import AdministratorsTable from "./administrators-table"; +import { UsersConstants } from "../../../../../extensions/components/users/constants/users"; import { AccessControlConstants } from "../../../../access-control/constants/access-control"; import { AdvancedSearchWithBasicFilters, @@ -44,6 +43,7 @@ import { } from "../../../../core"; import { useGetCurrentOrganizationType } from "../../../../organizations/hooks/use-get-organization-type"; import { PRIMARY_USERSTORE } from "../../../../userstores/constants"; +import { UserStoreDropdownItem } from "../../../../userstores/models"; import useAdministrators from "../../../hooks/use-administrators"; import useBulkAssignAdministratorRoles from "../../../hooks/use-bulk-assign-user-roles"; import AddExistingUserWizard from "../add-existing-user-wizard/add-existing-user-wizard"; @@ -212,13 +212,13 @@ const AdministratorsList: React.FunctionComponent = ( { "data-componentid": `${ componentId }-add-existing-user-dropdown-item`, key: 1, - text: t("console:consoleSettings.administrators.add.options.addExistingUser"), + text: t("consoleSettings:administrators.add.options.addExistingUser"), value: AddAdministratorModes.AddExisting }, { "data-componentid": `${ componentId }-invite-new-user-dropdown-item`, key: 2, - text: t("console:consoleSettings.administrators.add.options.inviteNewUser"), + text: t("consoleSettings:administrators.add.options.inviteNewUser"), value: AddAdministratorModes.InviteNew } ]; @@ -238,7 +238,7 @@ const AdministratorsList: React.FunctionComponent = ( className="add-administrator-dropdown-trigger" > - { t("console:consoleSettings.administrators.add.action") } + { t("consoleSettings:administrators.add.action") } ) } @@ -268,7 +268,7 @@ const AdministratorsList: React.FunctionComponent = ( onClick={ () => setShowAddExistingUserWizard(true) } > - { t("console:consoleSettings.administrators.add.action") } + { t("consoleSettings:administrators.add.action") } ); }; diff --git a/apps/console/src/features/console-settings/components/console-roles/create-console-role-wizard/create-console-role-wizard-permissions-form.tsx b/apps/console/src/features/console-settings/components/console-roles/create-console-role-wizard/create-console-role-wizard-permissions-form.tsx index 633e6dbc8ad..a82e4dc55f4 100644 --- a/apps/console/src/features/console-settings/components/console-roles/create-console-role-wizard/create-console-role-wizard-permissions-form.tsx +++ b/apps/console/src/features/console-settings/components/console-roles/create-console-role-wizard/create-console-role-wizard-permissions-form.tsx @@ -394,7 +394,7 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent - { t("console:consoleSettings.roles.add.tenantPermissions.label") } + { t("consoleSettings:roles.add.tenantPermissions.label") } { filteredTenantAPIResourceCollections?.apiResourceCollections?.length } Permissions @@ -462,10 +462,10 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent - { t("console:consoleSettings.roles.permissionLevels.view") } + { t("consoleSettings:roles.permissionLevels.view") } - { t("console:consoleSettings.roles.permissionLevels.edit") } + { t("consoleSettings:roles.permissionLevels.edit") } @@ -506,7 +506,7 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent - { t("console:consoleSettings.roles.add.organizationPermissions.label") } + { t("consoleSettings:roles.add.organizationPermissions.label") } { filteredOrganizationAPIResourceCollections?.apiResourceCollections?.length } Permissions @@ -575,10 +575,10 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent - { t("console:consoleSettings.roles.permissionLevels.view") } + { t("consoleSettings:roles.permissionLevels.view") } - { t("console:consoleSettings.roles.permissionLevels.edit") } + { t("consoleSettings:roles.permissionLevels.edit") } diff --git a/apps/console/src/features/console-settings/components/console-settings-tabs.tsx b/apps/console/src/features/console-settings/components/console-settings-tabs.tsx index c5fca639bd4..aa1ff80fe06 100644 --- a/apps/console/src/features/console-settings/components/console-settings-tabs.tsx +++ b/apps/console/src/features/console-settings/components/console-settings-tabs.tsx @@ -88,7 +88,7 @@ const ConsoleSettingsTabs: FunctionComponent = ( "data-componentid": `${componentId}-tab-administrators`, "data-tabid": ConsoleSettingsModes.ADMINISTRATORS, id: ConsoleSettingsModes.ADMINISTRATORS, - label: t("console:consoleSettings.administrators.tabLabel"), + label: t("consoleSettings:administrators.tabLabel"), pane: , value: ConsoleSettingsTabIDs.ADMINISTRATORS }, @@ -97,7 +97,7 @@ const ConsoleSettingsTabs: FunctionComponent = ( "data-componentid": `${componentId}-tab-roles`, "data-tabid": ConsoleSettingsModes.ROLES, id: ConsoleSettingsModes.ROLES, - label: t("console:consoleSettings.roles.tabLabel"), + label: t("consoleSettings:roles.tabLabel"), pane: , value: ConsoleSettingsTabIDs.ROLES }, @@ -106,7 +106,7 @@ const ConsoleSettingsTabs: FunctionComponent = ( "data-componentid": `${componentId}-tab-login-flow`, "data-tabid": ConsoleSettingsModes.LOGIN_FLOW, id: ConsoleSettingsModes.LOGIN_FLOW, - label: t("console:consoleSettings.loginFlow.tabLabel"), + label: t("consoleSettings:loginFlow.tabLabel"), pane: , value: ConsoleSettingsTabIDs.LOGIN_FLOW }, @@ -116,7 +116,7 @@ const ConsoleSettingsTabs: FunctionComponent = ( "data-tabid": ConsoleSettingsModes.PROTOCOL, hidden: true, id: ConsoleSettingsModes.PROTOCOL, - label: t("console:consoleSettings.protocol.tabLabel"), + label: t("consoleSettings:protocol.tabLabel"), pane: , value: ConsoleSettingsTabIDs.PROTOCOL } diff --git a/apps/console/src/features/console-settings/pages/console-administrator-edit-page.tsx b/apps/console/src/features/console-settings/pages/console-administrator-edit-page.tsx index ec90a983135..f2e7676ca1b 100644 --- a/apps/console/src/features/console-settings/pages/console-administrator-edit-page.tsx +++ b/apps/console/src/features/console-settings/pages/console-administrator-edit-page.tsx @@ -330,7 +330,7 @@ const ConsoleAdministratorsEditPage: FunctionComponent} - * @default */ public static readonly BUNDLE_NAMESPACE_DIRECTORIES: Map = new Map([ [ I18nConstants.COMMON_NAMESPACE, "portals" ], [ I18nConstants.CONSOLE_PORTAL_NAMESPACE, "portals" ], - [ I18nConstants.EXTENSIONS_NAMESPACE, "portals" ] + [ I18nConstants.EXTENSIONS_NAMESPACE, "portals" ], + [ "consoleSettings", "portals" ] ]); /** * I18n init options override flag. The default options in the module will be overridden if set to true. - * @constant - * @type {boolean} - * @default */ public static readonly INIT_OPTIONS_OVERRIDE: boolean = false; /** * If the language detector plugin should be enabled or not. - * @constant - * @type {boolean} - * @default */ public static readonly LANG_AUTO_DETECT_ENABLED: boolean = true; /** * If the xhr backend plugin should be enabled or not. - * @constant - * @type {boolean} - * @default */ public static readonly XHR_BACKEND_PLUGIN_ENABLED: boolean = true; /** * Default fallback language. - * @constant - * @type {string} - * @default */ public static readonly DEFAULT_FALLBACK_LANGUAGE: string = I18nModuleConstants.DEFAULT_FALLBACK_LANGUAGE; } diff --git a/modules/i18n/src/models/namespaces/console-ns.ts b/modules/i18n/src/models/namespaces/console-ns.ts index 29593ed455a..6a35992f538 100644 --- a/modules/i18n/src/models/namespaces/console-ns.ts +++ b/modules/i18n/src/models/namespaces/console-ns.ts @@ -617,42 +617,6 @@ export interface ConsoleNS { placeholder: string; }; }; - consoleSettings: { - administrators: { - add: { - action: string; - options: { - addExistingUser: string; - inviteNewUser: string; - }; - }; - edit: { - backButton: string; - }; - tabLabel: string; - }; - loginFlow: { - tabLabel: string; - }; - protocol: { - tabLabel: string; - }; - roles: { - add: { - organizationPermissions: { - label: string; - }; - tenantPermissions: { - label: string; - }; - }; - tabLabel: string; - permissionLevels: { - edit: string; - view: string; - }; - }; - }; featureGate: { enabledFeatures: { tags: { diff --git a/modules/i18n/src/models/namespaces/console-settings-ns.ts b/modules/i18n/src/models/namespaces/console-settings-ns.ts new file mode 100644 index 00000000000..591579dbafe --- /dev/null +++ b/modules/i18n/src/models/namespaces/console-settings-ns.ts @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export interface ConsoleSettingsNS { + administrators: { + add: { + action: string; + options: { + addExistingUser: string; + inviteNewUser: string; + }; + }; + edit: { + backButton: string; + }; + tabLabel: string; + }; + loginFlow: { + tabLabel: string; + }; + protocol: { + tabLabel: string; + }; + roles: { + add: { + organizationPermissions: { + label: string; + }; + tenantPermissions: { + label: string; + }; + }; + tabLabel: string; + permissionLevels: { + edit: string; + view: string; + }; + }; +} diff --git a/modules/i18n/src/models/namespaces/index.ts b/modules/i18n/src/models/namespaces/index.ts index a8bb2850060..78904b07194 100644 --- a/modules/i18n/src/models/namespaces/index.ts +++ b/modules/i18n/src/models/namespaces/index.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -19,3 +19,4 @@ export * from "./common-ns"; export * from "./console-ns"; export * from "./myaccount-ns"; +export * from "./console-settings-ns"; diff --git a/modules/i18n/src/translations/en-US/meta.ts b/modules/i18n/src/translations/en-US/meta.ts index d20ca4505bf..b3936beae24 100644 --- a/modules/i18n/src/translations/en-US/meta.ts +++ b/modules/i18n/src/translations/en-US/meta.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -27,6 +27,7 @@ export const meta: LocaleMeta = { I18nModuleConstants.COMMON_NAMESPACE, I18nModuleConstants.CONSOLE_PORTAL_NAMESPACE, I18nModuleConstants.MY_ACCOUNT_NAMESPACE, - I18nModuleConstants.EXTENSIONS_NAMESPACE + I18nModuleConstants.EXTENSIONS_NAMESPACE, + "consoleSettings" ] }; diff --git a/modules/i18n/src/translations/en-US/portals/console-settings.ts b/modules/i18n/src/translations/en-US/portals/console-settings.ts new file mode 100644 index 00000000000..0607ffff90d --- /dev/null +++ b/modules/i18n/src/translations/en-US/portals/console-settings.ts @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { ConsoleSettingsNS } from "../../../models"; + +/** + * NOTES: No need to care about the max-len for this file since it's easier to + * translate the strings to other languages easily with editor translation tools. + */ +/* eslint-disable max-len */ +/* eslint-disable sort-keys */ +export const consoleSettings: ConsoleSettingsNS = { + administrators: { + add: { + action: "Add Administrator", + options: { + addExistingUser: "Add Existing User", + inviteNewUser: "Invite New User" + } + }, + edit: { + backButton: "Go back to Administrators" + }, + tabLabel: "Administrators" + }, + loginFlow: { + tabLabel: "Login Flow" + }, + protocol: { + tabLabel: "Protocol" + }, + roles: { + add: { + organizationPermissions: { + label: "Organization Permissions" + }, + tenantPermissions: { + label: "Root Organization Permissions" + } + }, + tabLabel: "Roles", + permissionLevels: { + edit: "Edit", + view: "View" + } + } +}; diff --git a/modules/i18n/src/translations/en-US/portals/console.ts b/modules/i18n/src/translations/en-US/portals/console.ts index 7c9066cb23f..7c10bc6514c 100644 --- a/modules/i18n/src/translations/en-US/portals/console.ts +++ b/modules/i18n/src/translations/en-US/portals/console.ts @@ -734,42 +734,6 @@ export const console: ConsoleNS = { placeholder: "Select screen" } }, - consoleSettings: { - administrators: { - add: { - action: "Add Administrator", - options: { - addExistingUser: "Add Existing User", - inviteNewUser: "Invite New User" - } - }, - edit: { - backButton: "Go back to Administrators" - }, - tabLabel: "Administrators" - }, - loginFlow: { - tabLabel: "Login Flow" - }, - protocol: { - tabLabel: "Protocol" - }, - roles: { - add: { - organizationPermissions: { - label: "Organization Permissions" - }, - tenantPermissions: { - label: "Root Organization Permissions" - } - }, - tabLabel: "Roles", - permissionLevels: { - edit: "Edit", - view: "View" - } - } - }, featureGate: { enabledFeatures: { tags: { diff --git a/modules/i18n/src/translations/en-US/portals/index.ts b/modules/i18n/src/translations/en-US/portals/index.ts index 54145478ba0..5e308ddad6d 100644 --- a/modules/i18n/src/translations/en-US/portals/index.ts +++ b/modules/i18n/src/translations/en-US/portals/index.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -19,3 +19,4 @@ export * from "./common"; export * from "./console"; export * from "./myaccount"; +export * from "./console-settings"; From aa53deae46c79a11686cce741664f14c843c97e5 Mon Sep 17 00:00:00 2001 From: jathushan-r Date: Mon, 25 Mar 2024 10:01:30 +0530 Subject: [PATCH 2/2] add consoleSettings in i18n constants --- apps/console/src/features/core/configs/app.ts | 2 +- .../src/features/core/constants/i18n-constants.ts | 7 ++++++- modules/i18n/src/constants.ts | 10 +++++++++- modules/i18n/src/models/namespaces/index.ts | 2 +- modules/i18n/src/translations/en-US/meta.ts | 3 ++- modules/i18n/src/translations/en-US/portals/index.ts | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/console/src/features/core/configs/app.ts b/apps/console/src/features/core/configs/app.ts index 0f7fbe1a7a3..e719474daf0 100644 --- a/apps/console/src/features/core/configs/app.ts +++ b/apps/console/src/features/core/configs/app.ts @@ -192,7 +192,7 @@ export class Config { I18nConstants.COMMON_NAMESPACE, I18nConstants.CONSOLE_PORTAL_NAMESPACE, I18nConstants.EXTENSIONS_NAMESPACE, - "consoleSettings" + I18nConstants.CONSOLE_SETTINGS_NAMESPACE ], preload: [] }; diff --git a/apps/console/src/features/core/constants/i18n-constants.ts b/apps/console/src/features/core/constants/i18n-constants.ts index c35ca5f3e3f..e49362ac764 100644 --- a/apps/console/src/features/core/constants/i18n-constants.ts +++ b/apps/console/src/features/core/constants/i18n-constants.ts @@ -45,6 +45,11 @@ export class I18nConstants { */ public static readonly EXTENSIONS_NAMESPACE: string = I18nModuleConstants.EXTENSIONS_NAMESPACE; + /** + * console settings namespace. + */ + public static readonly CONSOLE_SETTINGS_NAMESPACE: string = I18nModuleConstants.CONSOLE_SETTINGS_NAMESPACE; + /** * Locations of the I18n namespaces. */ @@ -52,7 +57,7 @@ export class I18nConstants { [ I18nConstants.COMMON_NAMESPACE, "portals" ], [ I18nConstants.CONSOLE_PORTAL_NAMESPACE, "portals" ], [ I18nConstants.EXTENSIONS_NAMESPACE, "portals" ], - [ "consoleSettings", "portals" ] + [ I18nConstants.CONSOLE_SETTINGS_NAMESPACE, "portals" ] ]); /** diff --git a/modules/i18n/src/constants.ts b/modules/i18n/src/constants.ts index a1cd007e9d8..5324e232c04 100644 --- a/modules/i18n/src/constants.ts +++ b/modules/i18n/src/constants.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -85,4 +85,12 @@ export class I18nModuleConstants { * @default */ public static readonly META_FILENAME: string = "meta.json"; + + /** + * Console settings namespace. + * @constant + * @type {string} + * @default + */ + public static readonly CONSOLE_SETTINGS_NAMESPACE: string = "consoleSettings"; } diff --git a/modules/i18n/src/models/namespaces/index.ts b/modules/i18n/src/models/namespaces/index.ts index 78904b07194..2d3f4bd2ac7 100644 --- a/modules/i18n/src/models/namespaces/index.ts +++ b/modules/i18n/src/models/namespaces/index.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except diff --git a/modules/i18n/src/translations/en-US/meta.ts b/modules/i18n/src/translations/en-US/meta.ts index b3936beae24..df45d3f5ca4 100644 --- a/modules/i18n/src/translations/en-US/meta.ts +++ b/modules/i18n/src/translations/en-US/meta.ts @@ -28,6 +28,7 @@ export const meta: LocaleMeta = { I18nModuleConstants.CONSOLE_PORTAL_NAMESPACE, I18nModuleConstants.MY_ACCOUNT_NAMESPACE, I18nModuleConstants.EXTENSIONS_NAMESPACE, - "consoleSettings" + I18nModuleConstants.CONSOLE_SETTINGS_NAMESPACE, + I18nModuleConstants.FEATURE_GATE_NAMESPACE ] }; diff --git a/modules/i18n/src/translations/en-US/portals/index.ts b/modules/i18n/src/translations/en-US/portals/index.ts index 5e308ddad6d..830e4d9fe44 100644 --- a/modules/i18n/src/translations/en-US/portals/index.ts +++ b/modules/i18n/src/translations/en-US/portals/index.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except