Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize i18n strings in API Resource UIs #4369

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2023, 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
Expand All @@ -21,6 +21,8 @@ import { Field, Form } from "@wso2is/form";
import { DocumentationLink, Message, useDocumentation } from "@wso2is/react-components";
import React, { FunctionComponent, ReactElement } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { AppState } from "../../../../../../features/core/store";
import { ExtendedFeatureConfigInterface } from "../../../../../configs/models";
import { AuthorizationAPIResourceInterface } from "../../../models";

Expand Down Expand Up @@ -69,6 +71,7 @@ export const AddAPIResourceAuthorization: FunctionComponent<AddAPIResourceAuthor

const { t } = useTranslation();
const { getLink } = useDocumentation();
const productName: string = useSelector((state: AppState) => state.config.ui.productName);

/**
* Prepare form values for submitting.
Expand All @@ -94,7 +97,7 @@ export const AddAPIResourceAuthorization: FunctionComponent<AddAPIResourceAuthor
content={
(<>
{ t("extensions:develop.apiResource.wizard.addApiResource.steps.authorization.form." +
"rbacMessage") }
"rbacMessage", { productName: productName }) }
SujanSanjula96 marked this conversation as resolved.
Show resolved Hide resolved
<DocumentationLink
link={ getLink("develop.apiResources.addAPIResource.rbacInfoBox.learnMore") }
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2023, 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
Expand All @@ -21,7 +21,9 @@ import { Field, FormField, FormValue, Forms, Validation } from "@wso2is/forms";
import { Hint } from "@wso2is/react-components";
import React, { FunctionComponent, MutableRefObject, ReactElement, useRef } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { Grid } from "semantic-ui-react";
import { AppState } from "../../../../../../features/core/store";
import { ExtendedFeatureConfigInterface } from "../../../../../configs/models";
import { getAPIResourcesForIdenitifierValidation } from "../../../api";
import { APIResourcesConstants } from "../../../constants";
Expand Down Expand Up @@ -80,6 +82,7 @@ export const AddAPIResourceBasic: FunctionComponent<AddAPIResourceBasicInterface

const { t } = useTranslation();
const identifierRef: MutableRefObject<FormField> = useRef<FormField>();
const productName: string = useSelector((state: AppState) => state.config.ui.productName);

/**
* Prepare form values for submitting.
Expand Down Expand Up @@ -146,7 +149,8 @@ export const AddAPIResourceBasic: FunctionComponent<AddAPIResourceBasicInterface
<Hint className="mb-0">
<Trans
i18nKey= { "extensions:develop.apiResource.wizard.addApiResource.steps.basic." +
"form.fields.identifier.hint" }>
"form.fields.identifier.hint" }
tOptions={ { productName: productName } }>
SujanSanjula96 marked this conversation as resolved.
Show resolved Hide resolved
We recommend using a URI as the identifier, but you do not need to make the URI
publicly available since Asgardeo will not access your API.
Asgardeo will use this identifier value as the audience(aud) claim in the
Expand All @@ -173,7 +177,7 @@ export const AddAPIResourceBasic: FunctionComponent<AddAPIResourceBasicInterface
/>
<Hint className="mb-0">
{ t("extensions:develop.apiResource.wizard.addApiResource.steps.basic.form.fields." +
"name.hint") }
"name.hint", { productName: productName }) }
</Hint>
</Grid.Column>
</Grid.Row>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2023, 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
Expand Down Expand Up @@ -35,9 +35,10 @@ import {
} from "@wso2is/react-components";
import React, { FunctionComponent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import { Dispatch } from "redux";
import { Dropdown, DropdownItemProps, DropdownProps, Grid, Header, Modal } from "semantic-ui-react";
import { AppState } from "../../../../../../features/core/store";
import { useAPIResources } from "../../../../api-resources/api";
import { APIResourcesConstants } from "../../../../api-resources/constants";
import { APIResourceInterface, APIResourcePermissionInterface } from "../../../../api-resources/models";
Expand Down Expand Up @@ -78,6 +79,7 @@ export const AuthorizeAPIResource: FunctionComponent<AuthorizeAPIResourcePropsIn
const dispatch: Dispatch = useDispatch();
const { getLink } = useDocumentation();
const [ submitForm, setSubmitForm ] = useTrigger();
const productName: string = useSelector((state: AppState) => state.config.ui.productName);

const [ allAPIResourcesListData, setAllAPIResourcesListData ] = useState<APIResourceInterface[]>([]);
const [ isSubmitting, setIsSubmitting ] = useState<boolean>(false);
Expand Down Expand Up @@ -473,7 +475,8 @@ export const AuthorizeAPIResource: FunctionComponent<AuthorizeAPIResourcePropsIn
<Popup
content={ t("extensions:develop.applications.edit.sections." +
"apiAuthorization.sections.apiSubscriptions.wizards." +
"authorizeAPIResource.rbacPolicyMessage") }
"authorizeAPIResource.rbacPolicyMessage",
{ productName: productName }) }
disabled={ !selectedAPIResource
|| !selectedAPIResourceRequiresAuthorization }
inverted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,14 @@ export const extensions: Extensions = {
name: {
emptyValidate: "Display name cannot be empty",
label: "Display Name",
hint: "Meaningful name to identify your API resource in Asgardeo.",
hint: "Meaningful name to identify your API resource in {{ productName }}.",
placeholder: "Bookings API"
},
identifier: {
emptyValidate: "Identifier cannot be empty",
alreadyExistsError: "Identifier already exists in the organization. Please choose a different one.",
invalid: "Identifier cannot contain spaces",
hint: "We recommend using a URI as the identifier, but you do not need to make the URI publicly available since Asgardeo will not access your API. Asgardeo will use this identifier value as the audience(aud) claim in the issued JWT tokens. <1>This field should be unique; once created, it is not editable.</1>",
hint: "We recommend using a URI as the identifier, but you do not need to make the URI publicly available since {{ productName }} will not access your API. {{ productName }} will use this identifier value as the audience(aud) claim in the issued JWT tokens. <1>This field should be unique; once created, it is not editable.</1>",
label: "Identifier",
placeholder: "https://api.bookmyhotel.com"
},
Expand All @@ -724,7 +724,7 @@ export const extensions: Extensions = {
authorization: {
stepTitle: "Authorization",
form: {
rbacMessage: "At present, Asgardeo exclusively supports Role-Based Access Control (RBAC) for authorization.",
rbacMessage: "At present, {{ productName }} exclusively supports Role-Based Access Control (RBAC) for authorization.",
fields: {
authorize: {
label: "Requires authorization",
Expand Down Expand Up @@ -919,7 +919,7 @@ export const extensions: Extensions = {
hint: "Select the policy to authorize the API for the application."
}
},
rbacPolicyMessage: "This API resource requires authorization and Asgardeo exclusively supports Role-Based Access Control (RBAC) for authorization.",
rbacPolicyMessage: "This API resource requires authorization and {{ productName }} exclusively supports Role-Based Access Control (RBAC) for authorization.",
buttons: {
finish: "Finish",
cancel: "Cancel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,14 @@ export const extensions: Extensions = {
name: {
emptyValidate: "Le nom de l'affichage ne peut pas être vide",
label: "Afficher un nom",
hint: "Nom significatif pour identifier votre ressource API dans Asgardeo.",
hint: "Nom significatif pour identifier votre ressource API dans {{ productName }}.",
placeholder: "API des réservations"
},
identifier: {
emptyValidate: "L'identifiant ne peut pas être vide",
alreadyExistsError: "L'identifiant existe déjà dans l'organisation.Veuillez en choisir un autre",
invalid: "L'identifiant ne peut pas contenir d'espaces",
hint: "Nous vous recommandons d'utiliser une URI comme identifiant, mais vous n'avez pas besoin de rendre l'URI accessible au public car Asgardeo n'accèdera pas à votre API. Asgardeo utilisera cette valeur d'identifiant comme la réclamation d'audience(aud) dans les jetons JWT émis. <1>Ce champ devrait être unique;Une fois créé, il n'est pas modifiable.</1>",
hint: "Nous vous recommandons d'utiliser une URI comme identifiant, mais vous n'avez pas besoin de rendre l'URI accessible au public car {{ productName }} n'accèdera pas à votre API. {{ productName }} utilisera cette valeur d'identifiant comme la réclamation d'audience(aud) dans les jetons JWT émis. <1>Ce champ devrait être unique;Une fois créé, il n'est pas modifiable.</1>",
label: "Identifiant",
placeholder: "https://api.bookmyhotel.com"
},
Expand All @@ -724,7 +724,7 @@ export const extensions: Extensions = {
authorization: {
stepTitle: "Autorisation",
form: {
rbacMessage: "À l'heure actuelle, Asgardeo prend en charge exclusivement le contrôle d'accès basé sur les rôles (RBAC) pour l'autorisation.",
rbacMessage: "À l'heure actuelle, {{ productName }} prend en charge exclusivement le contrôle d'accès basé sur les rôles (RBAC) pour l'autorisation.",
fields: {
authorize: {
label: "Nécessite une autorisation",
Expand Down Expand Up @@ -920,7 +920,7 @@ export const extensions: Extensions = {
hint: "Sélectionnez la politique pour autoriser l'API pour l'application."
}
},
rbacPolicyMessage: "Cette ressource API nécessite l'autorisation et Asgardeo prend en charge exclusivement le contrôle d'accès basé sur les rôles (RBAC) pour l'autorisation.",
rbacPolicyMessage: "Cette ressource API nécessite l'autorisation et {{ productName }} prend en charge exclusivement le contrôle d'accès basé sur les rôles (RBAC) pour l'autorisation.",
buttons: {
finish: "Finir",
cancel: "Annuler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,14 @@ export const extensions: Extensions = {
name: {
emptyValidate: "ප්රදර්ශන නම හිස් විය නොහැක",
label: "ප්රදර්ශන නාමය",
hint: "Asgardeo හි ඔබගේ API සම්පත හඳුනා ගැනීම සඳහා අර්ථවත් නම.",
hint: "{{ productName }} හි ඔබගේ API සම්පත හඳුනා ගැනීම සඳහා අර්ථවත් නම.",
placeholder: "වෙන්කරවා ගැනීම සදහා වූ API"
},
identifier: {
emptyValidate: "හඳුනාගැනුම හිස් විය නොහැක",
alreadyExistsError: "හඳුනාගැනුම දැනටමත් සංවිධානය තුළ පවතී.කරුණාකර වෙනත් එකක් තෝරන්න",
invalid: "හඳුනාගැනුමක අවකාශයන් අඩංගු විය නොහැක",
hint: "අනන්යතාවය ලෙස URI එකක් භාවිතා කිරීම අපි නිර්දේශ කරමු, නමුත් Asgardeo ඔබගේ API වෙත ප්‍රවේශ නොවන බැවින් ඔබට URI ප්‍රසිද්ධ කිරීමට අවශ්‍ය නොවේ. Asgardeo විසින් නිකුත් කරන ලද JWT ටෝකනවල ප්රේක්ෂක(aud) ප්රකාශය ලෙස මෙම හඳුනාගැනීම් අගය භාවිතා කරනු ඇත. <1>මෙම ක්ෂේත්රය අද්විතීය විය යුතුය;මැවූ පසු, එය සංස්කරණය කළ නොහැක.</1>",
hint: "අනන්යතාවය ලෙස URI එකක් භාවිතා කිරීම අපි නිර්දේශ කරමු, නමුත් {{ productName }} ඔබගේ API වෙත ප්‍රවේශ නොවන බැවින් ඔබට URI ප්‍රසිද්ධ කිරීමට අවශ්‍ය නොවේ. {{ productName }} විසින් නිකුත් කරන ලද JWT ටෝකනවල ප්රේක්ෂක(aud) ප්රකාශය ලෙස මෙම හඳුනාගැනීම් අගය භාවිතා කරනු ඇත. <1>මෙම ක්ෂේත්රය අද්විතීය විය යුතුය;මැවූ පසු, එය සංස්කරණය කළ නොහැක.</1>",
label: "හඳුනාගැනුම",
placeholder: "https://api.bookmyhotel.com"
},
Expand All @@ -714,7 +714,7 @@ export const extensions: Extensions = {
authorization: {
stepTitle: "බලය පැවරීම",
form: {
rbacMessage: "මේ වන විට Asgardeo අවසරය සඳහා Role Based Access Control (RBAC) සදහා පමණක් සීමා වේ.",
rbacMessage: "මේ වන විට {{ productName }} අවසරය සඳහා Role Based Access Control (RBAC) සදහා පමණක් සීමා වේ.",
fields: {
authorize: {
label: "අවසරය අවශ්ය වේ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { Field, Form } from "@wso2is/form";
import { DocumentationLink, Message, useDocumentation } from "@wso2is/react-components";
import React, { FunctionComponent, ReactElement } from "react";
import { Trans, useTranslation } from "react-i18next";
import { FeatureConfigInterface } from "../../../../core";
import { useSelector } from "react-redux";
import { AppState, FeatureConfigInterface } from "../../../../core";
import { AuthorizationAPIResourceInterface } from "../../../models";

/**
Expand Down Expand Up @@ -69,6 +70,7 @@ export const AddAPIResourceAuthorization: FunctionComponent<AddAPIResourceAuthor

const { t } = useTranslation();
const { getLink } = useDocumentation();
const productName: string = useSelector((state: AppState) => state.config.ui.productName);

/**
* Prepare form values for submitting.
Expand All @@ -94,7 +96,7 @@ export const AddAPIResourceAuthorization: FunctionComponent<AddAPIResourceAuthor
content={
(<>
{ t("extensions:develop.apiResource.wizard.addApiResource.steps.authorization.form." +
"rbacMessage") }
"rbacMessage", { productName: productName }) }
<DocumentationLink
link={ getLink("develop.apiResources.addAPIResource.rbacInfoBox.learnMore") }
>
Expand Down
Loading
Loading