Skip to content

Commit

Permalink
Merge pull request #5807 from thiva-k/i18n-separate-11
Browse files Browse the repository at this point in the history
Separate i18n namespaces feature-wise [ insights and smsProviders ]
  • Loading branch information
JayaShakthi97 committed Mar 26, 2024
2 parents dccf7d5 + f62639f commit 4462163
Show file tree
Hide file tree
Showing 23 changed files with 688 additions and 112 deletions.
2 changes: 2 additions & 0 deletions apps/console/src/features/core/configs/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export class Config {
I18nConstants.COMMON_NAMESPACE,
I18nConstants.CONSOLE_PORTAL_NAMESPACE,
I18nConstants.EXTENSIONS_NAMESPACE,
I18nConstants.INSIGHTS_NAMESPACE,
I18nConstants.SMS_PROVIDERS_NAMESPACE,
I18nConstants.CLAIMS_NAMESPACE,
I18nConstants.EMAIL_LOCALE_NAMESPACE,
I18nConstants.HELP_PANEL_NAMESPACE,
Expand Down
12 changes: 12 additions & 0 deletions apps/console/src/features/core/constants/i18n-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ export class I18nConstants {
*/
public static readonly EXTENSIONS_NAMESPACE: string = I18nModuleConstants.EXTENSIONS_NAMESPACE;

/**
* insights namespace.
*/
public static readonly INSIGHTS_NAMESPACE: string = I18nModuleConstants.INSIGHTS_NAMESPACE;

/**
* SMS Providers namespace.
*/
public static readonly SMS_PROVIDERS_NAMESPACE: string = I18nModuleConstants.SMS_PROVIDERS_NAMESPACE;

/**
* Claims namespace.
*/
Expand Down Expand Up @@ -103,6 +113,8 @@ export class I18nConstants {
[ I18nConstants.COMMON_NAMESPACE, "portals" ],
[ I18nConstants.CONSOLE_PORTAL_NAMESPACE, "portals" ],
[ I18nConstants.EXTENSIONS_NAMESPACE, "portals" ],
[ I18nConstants.INSIGHTS_NAMESPACE, "portals" ],
[ I18nConstants.SMS_PROVIDERS_NAMESPACE, "portals" ],
[ I18nConstants.CLAIMS_NAMESPACE, "portals" ],
[ I18nConstants.EMAIL_LOCALE_NAMESPACE, "portals" ],
[ I18nConstants.HELP_PANEL_NAMESPACE, "portals" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export const EmailAndSMSPage: FunctionComponent<EmailAndSMSPageInterface> = (
<Grid xs={ 12 } md={ 6 } lg={ 4 }>
<SettingsSection
data-componentid={ "sms-provider-card" }
description={ t("console:manage.features.smsProviders.description") }
description={ t("smsProviders:description") }
icon={ <SMSIcon fill="white" /> }
header={
t("console:manage.features.smsProviders.heading")
t("smsProviders:heading")
}
onPrimaryActionClick={ handleSMSSelection }
primaryAction={ t("common:configure") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ export const InsightsGraph: FunctionComponent<InsightsGraphProps> = (props: Insi
}).catch((error: Error) => {
dispatch(addAlert({
description: t(
"console:manage.features.insights.notifications.fetchInsights.genericError.description"
"insights:notifications.fetchInsights.genericError.description"
),
level: AlertLevels.ERROR,
message: t("console:manage.features.insights.notifications.fetchInsights.genericError.message")
message: t("insights:notifications.fetchInsights.genericError.message")
}));

throw error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,127 +42,127 @@ const filterValueDropdownItems: Record<string,DropdownChild[]> = {
{
key: 1,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"basic"
).toString(),
value: AuthenticatorFilterValue.BASIC
},
{
key: 2,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"identifierFirst"
).toString(),
value: AuthenticatorFilterValue.IDENTIFIER_FIRST
},
{
key: 3,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"fido2"
).toString(),
value: AuthenticatorFilterValue.FIDO2
},
{
key: 4,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"magicLink"
).toString(),
value: AuthenticatorFilterValue.MAGIC_LINK
},
{
key: 5,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"emailOtp"
).toString(),
value: AuthenticatorFilterValue.EMAIL_OTP
},
{
key: 6,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"smsOtp"
).toString(),
value: AuthenticatorFilterValue.SMS_OTP
},
{
key: 7,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"totp"
).toString(),
value: AuthenticatorFilterValue.TOTP
},
{
key: 8,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"backupCodes"
).toString(),
value: AuthenticatorFilterValue.BACK_UP_CODE
},
{
key: 9,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"google"
).toString(),
value: AuthenticatorFilterValue.GOOGLE
},
{
key: 10,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"facebook"
).toString(),
value: AuthenticatorFilterValue.FACEBOOK
},
{
key: 11,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"github"
).toString(),
value: AuthenticatorFilterValue.GITHUB
},
{
key: 12,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"apple"
).toString(),
value: AuthenticatorFilterValue.APPLE
},
{
key: 13,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"oidc"
).toString(),
value: AuthenticatorFilterValue.OIDC
},
{
key: 14,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"saml"
).toString(),
value: AuthenticatorFilterValue.SAML
},
{
key: 15,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"hypr"
).toString(),
value: AuthenticatorFilterValue.HYPR
},
{
key: 16,
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.values." +
"insights:activityType.login.filters.authenticator.values." +
"iproov"
).toString(),
value: AuthenticatorFilterValue.IPROOV
Expand All @@ -172,23 +172,23 @@ const filterValueDropdownItems: Record<string,DropdownChild[]> = {
{
key: 1,
text: I18n.instance.t(
"console:manage.features.insights.activityType.registration.filters.onboardingMethod.values." +
"insights:activityType.registration.filters.onboardingMethod.values." +
"adminInitiated"
).toString(),
value: OnboardingMethodFilterValue.ADMIN_INITIATED
},
{
key: 2,
text: I18n.instance.t(
"console:manage.features.insights.activityType.registration.filters.onboardingMethod.values." +
"insights:activityType.registration.filters.onboardingMethod.values." +
"userInvited"
).toString(),
value: OnboardingMethodFilterValue.USER_INVITE
},
{
key: 3,
text: I18n.instance.t(
"console:manage.features.insights.activityType.registration.filters.onboardingMethod.values." +
"insights:activityType.registration.filters.onboardingMethod.values." +
"selfSignUp"
).toString(),
value: OnboardingMethodFilterValue.SELF_SIGN_UP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const InsightsView: React.FunctionComponent<PropsWithChildren<InsightView
<div className="org-insights-duration-notice-container">
<p data-componentid="org-insights-helper-text" className="org-insights-helper-text">
<Trans
i18nKey={ "console:manage.features.insights.durationMessage" }
i18nKey={ "insights:durationMessage" }
tOptions={ {
endTimestamp: new Date(
getTimestamps(duration as DurationOption, { forDisplay: true }).endTimestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export const LoginInsights: FunctionComponent = () => {
<InsightsGraph
hint={ (
<Hint icon="question circle" popup inline className="org-insights-mau-tooltip">
{ t("console:manage.features.insights.graphs.activeUsers.titleHint") }
{ t("insights:graphs.activeUsers.titleHint") }
</Hint>)
}
graphTitle={ t("console:manage.features.insights.graphs.activeUsers.title") }
graphTitle={ t("insights:graphs.activeUsers.title") }
resourceType={ ResourceType.MONTHLY_ACTIVE_USERS }
data-componentid="org-insights-mau-graph"
/>
Expand All @@ -45,17 +45,17 @@ export const LoginInsights: FunctionComponent = () => {
<InsightsGraph
hint={ (
<Hint icon="question circle" popup inline className="org-insights-mau-tooltip">
{ t("console:manage.features.insights.graphs.successLogins.titleHint") }
{ t("insights:graphs.successLogins.titleHint") }
</Hint>)
}
graphTitle={ t("console:manage.features.insights.graphs.successLogins.title") }
graphTitle={ t("insights:graphs.successLogins.title") }
data-componentid="org-insights-success-logins-graph"
resourceType={ ResourceType.LOGIN_SUCCESS }
/>
</Grid>
<Grid xs={ 6 }>
<InsightsGraph
graphTitle={ t("console:manage.features.insights.graphs.failedLogins.title") }
graphTitle={ t("insights:graphs.failedLogins.title") }
data-componentid="org-insights-failed-logins-graph"
resourceType={ ResourceType.LOGIN_FAILURE }
primaryGraphColor={ OrgInsightsConstants.FAILED_LOGIN_GRAPH_COLOR }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export const SignupInsights: FunctionComponent = () => {
<InsightsGraph
hint={ (
<Hint icon="question circle" popup inline className="org-insights-mau-tooltip">
{ t("console:manage.features.insights.graphs.signups.titleHint") }
{ t("insights:graphs.signups.titleHint") }
</Hint>
) }
graphTitle={ t("console:manage.features.insights.graphs.signups.title") }
graphTitle={ t("insights:graphs.signups.title") }
resourceType={ ResourceType.USER_REGISTRATION }
data-componentid="org-insights-signup-graph"
/>
Expand Down
12 changes: 6 additions & 6 deletions apps/console/src/features/org-insights/config/org-insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const getFilterAttributeListByActivityType = (activityType: ActivityType)
const commonFilterAttributes: Omit<DropdownChild,"key">[] = [
{
text: I18n.instance.t(
"console:manage.features.insights.commonFilters.userId"
"insights:commonFilters.userId"
) as ReactNode,
value: "userId"
}
Expand All @@ -51,34 +51,34 @@ export const getFilterAttributeListByActivityType = (activityType: ActivityType)
[ActivityType.LOGIN]: [
{
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.serviceProvider"
"insights:activityType.login.filters.serviceProvider"
) as ReactNode,
value: "serviceProvider"
},
...commonFilterAttributes,
{
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.userStore"
"insights:activityType.login.filters.userStore"
) as ReactNode,
value: "userstoreDomain"
},
{
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.authenticator.attributeName"
"insights:activityType.login.filters.authenticator.attributeName"
) as ReactNode,
value: "authenticator"
},
{
text: I18n.instance.t(
"console:manage.features.insights.activityType.login.filters.identityProvider"
"insights:activityType.login.filters.identityProvider"
) as ReactNode,
value: "identityProvider"
}
],
[ActivityType.REGISTRATION]: [
{
text: I18n.instance.t(
"console:manage.features.insights.activityType.registration.filters.onboardingMethod.attributeName"
"insights:activityType.registration.filters.onboardingMethod.attributeName"
) as ReactNode,
value: "onboardingMethod"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ export class OrgInsightsConstants {
public static readonly DURATION_OPTIONS: DurationDropdownOption[] = [
{
key: DurationOption.LAST_07_DAYS,
text: "console:manage.features.insights.durationOption",
text: "insights:durationOption",
value: DurationOption.LAST_07_DAYS
},
{
key: DurationOption.LAST_14_DAYS,
text: "console:manage.features.insights.durationOption",
text: "insights:durationOption",
value: DurationOption.LAST_14_DAYS
},
{
key: DurationOption.LAST_30_DAYS,
text: "console:manage.features.insights.durationOption",
text: "insights:durationOption",
value: DurationOption.LAST_30_DAYS
}
]
Expand Down
10 changes: 5 additions & 5 deletions apps/console/src/features/org-insights/pages/org-insights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ const OrgInsightsPage: FunctionComponent = () => {
return (
<PageLayout
data-componentid="asgardeo-insights"
pageTitle={ t("console:manage.features.insights.pageTitle") }
title={ t("console:manage.features.insights.title") }
description={ t("console:manage.features.insights.description") }
pageTitle={ t("insights:pageTitle") }
title={ t("insights:title") }
description={ t("insights:description") }
action={
(<>
<Select
Expand All @@ -96,10 +96,10 @@ const OrgInsightsPage: FunctionComponent = () => {

<div className="org-insights-last-fetched-warning">
<Hint icon="warning sign" popup compact warning>
{ t("console:manage.features.insights.lastFetchedMessage.tooltipText") }
{ t("insights:lastFetchedMessage.tooltipText") }
</Hint>
<p>
{ t("console:manage.features.insights.lastFetchedMessage.label", {
{ t("insights:lastFetchedMessage.label", {
time: lastFetchTimestamp
}) }
</p>
Expand Down
Loading

0 comments on commit 4462163

Please sign in to comment.