From 5b8f992f41ab94bbbb528353b7e9dc5250a097a4 Mon Sep 17 00:00:00 2001 From: Quentin AUBERT Date: Fri, 29 Nov 2024 12:00:03 +0100 Subject: [PATCH] add translations --- .../backoffice/apis/TeamApiInfo.tsx | 12 ++++- .../frontend/api/ApiDescription.tsx | 7 ++- .../src/components/frontend/api/ApiHeader.tsx | 4 +- .../components/frontend/api/ApiPricing.tsx | 48 ++++++++++--------- .../src/locales/en/translation.json | 42 ++++++++++++---- .../src/locales/fr/translation.json | 34 ++++++++++--- 6 files changed, 102 insertions(+), 45 deletions(-) diff --git a/daikoku/javascript/src/components/backoffice/apis/TeamApiInfo.tsx b/daikoku/javascript/src/components/backoffice/apis/TeamApiInfo.tsx index a5e7badf1..d5549ef93 100644 --- a/daikoku/javascript/src/components/backoffice/apis/TeamApiInfo.tsx +++ b/daikoku/javascript/src/components/backoffice/apis/TeamApiInfo.tsx @@ -98,7 +98,8 @@ export const teamApiInfoForm = (translate: any, team: ITeamSimple, tenant: ITena customHeaderCmsPage: { type: type.string, format: format.select, - label: translate('CMS Page as Header'), + label: translate('api.form.cms.header.label'), + help: translate('api.form.cms.header.help'), props: { isClearable: true }, optionsFrom: getCmsPages, transformer: page => ({ @@ -230,11 +231,18 @@ export const teamApiInfoForm = (translate: any, team: ITeamSimple, tenant: ITena const flow = (expert: any) => [ { label: translate('Basic.informations'), - flow: ['state', 'name', 'smallDescription', 'image', 'header', 'customHeaderCmsPage'].filter((entry) => + flow: ['state', 'name', 'smallDescription', 'image'].filter((entry) => simpleOrExpertMode(entry, expert) ), collapsed: false, }, + { + label: translate('api.form.header.flow.label'), + flow: ['header', 'customHeaderCmsPage'].filter((entry) => + simpleOrExpertMode(entry, expert) + ), + collapsed: true, + }, { label: translate('Versions and tags'), flow: ['isDefault', 'currentVersion', 'supportedVersions', 'tags', 'categories'].filter( diff --git a/daikoku/javascript/src/components/frontend/api/ApiDescription.tsx b/daikoku/javascript/src/components/frontend/api/ApiDescription.tsx index cec1d3e0f..e232d620b 100644 --- a/daikoku/javascript/src/components/frontend/api/ApiDescription.tsx +++ b/daikoku/javascript/src/components/frontend/api/ApiDescription.tsx @@ -53,7 +53,7 @@ export const ApiDescription = ({
openRightPanel({ - title: translate('update.api.description.panel.title'), + title: translate('update.api.details.panel.title'), content:
queryClient.invalidateQueries({ queryKey: ["api"] })) //todo: get the right keys .then(() => closeRightPanel()) - .then(() => toast.success("update.api.sucecssful.toast.label")) + .then(() => toast.success("update.api.description.successful.toast.label")) }} value={api} + options={{actions: { + submit: {label: translate("Save")} + }}} />
})} diff --git a/daikoku/javascript/src/components/frontend/api/ApiHeader.tsx b/daikoku/javascript/src/components/frontend/api/ApiHeader.tsx index 0b41ec022..0aabd3f47 100644 --- a/daikoku/javascript/src/components/frontend/api/ApiHeader.tsx +++ b/daikoku/javascript/src/components/frontend/api/ApiHeader.tsx @@ -183,8 +183,8 @@ export const ApiHeader = ({
openRightPanel({ - title: translate({ key: "api.home.update.api.form.title", replacements: [api.name] }), - content:
+ title: translate("update.api.details.panel.title"), + content:
{ } ] - const quotasFlowPart: Flow = [{ label: "Configuration des quoats", flow: ["maxPerSecond", "maxPerDay", "maxPerMonth"], collapsed: true }] + const quotasFlowPart: Flow = [{ label: translate("usage.plan.form.quotas.flow.label"), flow: ["maxPerSecond", "maxPerDay", "maxPerMonth"], collapsed: true }] const billingFlow: Flow = [{ - label: "Configuration des frais", + label: translate("usage.plan.form.billing.flow.label"), flow: ["paymentSettings", "costPerRequest", "currency", "billingPeriod", "trialPeriod"], collapsed: true }] const customizationFlow: Flow = [{ - label: "Configuration des clés d'API", + label: translate("usage.plan.form.customization.flow.label"), flow: ["autoRotation", "allowMultipleKeys", "otoroshiTarget.apikeyCustomization", "integrationProcess"], collapsed: true }] @@ -701,13 +701,13 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { customDescription: { type: type.string, - label: 'Custom Description', - placeholder: 'Enter a description for this usage plan', + label: translate('Description'), + placeholder: translate('usage.plan.form.description.help'), format: format.textarea, }, visibility: { type: type.string, - label: 'Visibility', + label: translate('Visibility'), format: format.buttonsSelect, options: [ { label: 'Public', value: 'Public' }, @@ -721,6 +721,7 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { defaultValue: [], visible: ({ rawValues }) => rawValues['visibility'] !== 'Public', label: translate('Authorized teams'), + help: translate('usage.plan.form.authorized.teams.help'), optionsFrom: '/api/me/teams', transformer: (t: any) => ({ label: t.name, @@ -744,10 +745,6 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { tenant._id, props.ownerTeam ) - .then((r) => { - console.log({ r }); - return r; - }) .then((r) => (isError(r) ? [] : r)), transformer: (s: IOtoroshiSettings) => ({ label: s.url, @@ -989,25 +986,28 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { const quotasSchema: Schema = { maxPerSecond: { type: type.number, - label: 'Max Requests Per Second', - placeholder: 'Enter the maximum requests per second', - constraints: [constraints.min(1, 'Must be at least 1'), constraints.integer("value.must.be.integer")], + label: translate('usage.plan.form.max.request.second.label'), + help: translate('usage.plan.form.max.request.second.help'), + placeholder: translate('usage.plan.form.max.request.placeholder'), + constraints: [constraints.min(1, translate('constraints.positive')), constraints.integer(translate('constraints.integer'))], onChange: ({ value, setValue }) => setValue("maxPerSecond", Number(value) || null), defaultValue: 10 }, maxPerDay: { type: type.number, - label: 'Max Requests Per Day', - placeholder: 'Enter the maximum requests per day', - constraints: [constraints.min(1, 'Must be at least 1'), constraints.integer("value.must.be.integer")], + label: translate('usage.plan.form.max.request.day.label'), + help: translate('usage.plan.form.max.request.day.help'), + placeholder: translate('usage.plan.form.max.request.placeholder'), + constraints: [constraints.min(1, translate('constraints.positive')), constraints.integer(translate('constraints.integer'))], onChange: ({ value, setValue }) => setValue("maxPerDay", Number(value) || null), defaultValue: 10 }, maxPerMonth: { type: type.number, - label: 'Max Requests Per Month', - placeholder: 'Enter the maximum requests per month', - constraints: [constraints.min(1, 'Must be at least 1'), constraints.integer("value.must.be.integer")], + label: translate('usage.plan.form.max.request.month.label'), + help: translate('usage.plan.form.max.request.month.help'), + placeholder: translate('usage.plan.form.max.request.placeholder'), + constraints: [constraints.min(1, translate('constraints.positive')), constraints.integer(translate('constraints.integer'))], onChange: ({ value, setValue }) => setValue("maxPerMonth", Number(value) || null), defaultValue: 10 }, @@ -1017,13 +1017,13 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { paymentSettings: { type: type.object, format: format.form, - label: translate('payment settings'), + label: translate('usage.plan.form.payment.settings.label'), schema: { thirdPartyPaymentSettingsId: { type: type.string, format: format.select, - label: translate('Type'), - help: 'If no type is selected, use Daikoku APIs to get billing informations', + label: translate('usage.plan.form.payment.settings.id.label'), + help: translate('usage.plan.form.third.party.payment.help'), options: queryFullTenant.data ? (queryFullTenant.data as ITenantFull).thirdPartyPaymentSettings : [], @@ -1050,6 +1050,7 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { translate( `Cost per ${rawValues?.billingDuration?.unit.toLocaleLowerCase()}` ), + help: translate("usage.plan.form.cost.per.period.help"), placeholder: translate('Cost per billing period'), constraints: [constraints.positive(translate('constraints.positive'))], }, @@ -1057,6 +1058,7 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { type: type.number, label: translate('Cost per req.'), placeholder: translate('Cost per request'), + help: translate('usage.plan.form.cost.per.request.help'), constraints: [constraints.positive(translate('constraints.positive'))], }, currency: { @@ -1121,6 +1123,7 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { type: type.object, format: format.form, label: translate('Trial'), + help: translate('usage.plan.form.trial.period.help'), schema: { value: { type: type.number, @@ -1166,7 +1169,6 @@ const UsagePlanForm = (props: UsagePlanFormProps) => { return (
-