Skip to content

Commit

Permalink
Add translation support
Browse files Browse the repository at this point in the history
  • Loading branch information
AfraHussaindeen committed Nov 26, 2024
1 parent ebc30b2 commit 468ea6e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
PrimaryButton
} from "@wso2is/react-components";
import React, { FunctionComponent, ReactElement, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Trans, useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { Dispatch } from "redux";
import { Grid } from "semantic-ui-react";
Expand Down Expand Up @@ -102,26 +102,38 @@ export const EditAdditionalPropertiesLocalClaims:
<Grid>
<Grid.Row columns={ 1 }>
<Grid.Column width={ 16 }>
{ showWarning && UIConfig?.isClaimUniquenessValidationEnabled && (
{ showWarning && (
<Message
type="warning"
content={ (
<>
The &apos;isUnique&apos; property is deprecated. Please use the &nbsp;
<Link
external={ false }
onClick={ () => {
history.push({
pathname: AppConstants.getPaths()
.get("LOCAL_CLAIMS_EDIT")
.replace(":id", claim.id)
});
} }
>
Uniqueness Validation Dropdown
</Link>
&nbsp; to configure claim uniqueness.
</>
<Trans
i18nKey={
UIConfig?.isClaimUniquenessValidationEnabled
? "claims:local.additionalProperties." +
"isUniqueDeprecationMessage.uniquenessEnabled"
: "claims:local.additionalProperties." +
"isUniqueDeprecationMessage.uniquenessDisabled"
}
>
{ UIConfig?.isClaimUniquenessValidationEnabled ? (
<>
The &apos;isUnique&apos; property is deprecated. Please use the
<Link
external={ false }
onClick={ () => {
history.push({
pathname: AppConstants.getPaths()
.get("LOCAL_CLAIMS_EDIT")
.replace(":id", claim.id)
});
} }
> Uniqueness Validation Dropdown </Link>
to configure claim uniqueness.
</>
) : (
"The 'isUnique' property is deprecated."
) }
</Trans>
) }
data-componentid={ `${ testId }-restricted-warning` }
/>
Expand Down
4 changes: 4 additions & 0 deletions modules/i18n/src/models/namespaces/claims-ns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ export interface ClaimsNS {
};
additionalProperties: {
hint: string;
isUniqueDeprecationMessage: {
uniquenessDisabled: string;
uniquenessEnabled: string;
};
key: string;
value: string;
keyRequiredErrorMessage: string;
Expand Down
5 changes: 5 additions & 0 deletions modules/i18n/src/translations/en-US/portals/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ export const claims: ClaimsNS = {
local: {
additionalProperties: {
hint: "Use when writing an extension using current attributes",
isUniqueDeprecationMessage: {
uniquenessDisabled: "The 'isUnique' property is deprecated.",
uniquenessEnabled: "The 'isUnique' property is deprecated. Please use the " +
"<1>Uniqueness Validation Dropdown</1> to configure claim uniqueness."
},
key: "Name",
keyRequiredErrorMessage: "Enter a name",
value: "Value",
Expand Down

0 comments on commit 468ea6e

Please sign in to comment.