Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Nov 29, 2024
1 parent a9e1ad9 commit 5b8f992
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 45 deletions.
12 changes: 10 additions & 2 deletions daikoku/javascript/src/components/backoffice/apis/TeamApiInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ({
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ApiDescription = ({
<div className="dropdown-menu" aria-labelledby={`${api._humanReadableId}-dropdownMenuButton`}>
<span
onClick={() => openRightPanel({
title: translate('update.api.description.panel.title'),
title: translate('update.api.details.panel.title'),
content: <div>
<Form
schema={{
Expand All @@ -67,9 +67,12 @@ export const ApiDescription = ({
Services.saveTeamApi(ownerTeam._id, data, data.currentVersion)
.then(() => 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")}
}}}
/>
</div>
})}
Expand Down
4 changes: 2 additions & 2 deletions daikoku/javascript/src/components/frontend/api/ApiHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export const ApiHeader = ({
<div className="dropdown-menu" aria-labelledby={`${api._humanReadableId}-dropdownMenuButton`}>
<span
onClick={() => openRightPanel({
title: translate({ key: "api.home.update.api.form.title", replacements: [api.name] }),
content: <div className="text-center">
title: translate("update.api.details.panel.title"),
content: <div className="">
<Form
schema={informationForm.schema}
flow={informationForm.flow(expertMode)} //todo: get real flow, for admin api for example
Expand Down
48 changes: 25 additions & 23 deletions daikoku/javascript/src/components/frontend/api/ApiPricing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -642,15 +642,15 @@ const UsagePlanForm = (props: UsagePlanFormProps) => {
}
]

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
}]
Expand Down Expand Up @@ -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' },
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
},
Expand All @@ -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
: [],
Expand All @@ -1050,13 +1050,15 @@ 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'))],
},
costPerRequest: {
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: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1166,7 +1169,6 @@ const UsagePlanForm = (props: UsagePlanFormProps) => {
return (
<div className='usage-plan-form-panel-content'>
<div className="usage-plan-form">

<ToggleFormPartButton
value={quotasDisplayed}
action={setQuotasDisplayed}
Expand Down
42 changes: 32 additions & 10 deletions daikoku/javascript/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@
"Income": "Income",
"Edition": "Edition",
"Custom header": "Custom header",
"api.custom.header.help": "Use {{title}} to insert API title, {{ description }} to insert API small description. Add \"btn-edit\" class to link to admin API edition admin page",
"api.custom.header.help": "Define a custom HTML API header.Use {{title}} to insert API title, {{ description }} to insert API small description",
"get.apikey.requires.login": "Get an API key requires you to be logged in",
"consume.apikey": "Consume an API",
"Mongo migration": "MongoDB to Postgres migration",
Expand Down Expand Up @@ -933,7 +933,7 @@
"Authorized entities": "Authorized entities",
"Authorized.entities.placeholder": "Select Otoroshi service groups, services and/or routes",
"teamapi.new_version": "New version",
"authorized.entities.help": "Select Otoroshi service groups and/or services on which the key is authorized",
"authorized.entities.help": "Select Otoroshi service groups, services and/or routes on which the API key is authorized",
"apikey_select_modal.title": "Get an API key",
"apikey_select_modal.select_your_api_key": "Select your API key to extend",
"team_apikey_for_api.show_aggregate_sub": "Show aggregate subscriptions",
Expand Down Expand Up @@ -1450,8 +1450,8 @@
"subscription.successfully.enabled": "Your subscription has been successfully enabled",
"subscription.successfully.disabled": "Your subscription has been successfully disabled",
"subscription.custom.name.update.label": "Update custom subscription name",
"subscription.custom.name.update.message":"Subscription name",
"subscription.custom.name.update.placeholder":"Custom name",
"subscription.custom.name.update.message": "Subscription name",
"subscription.custom.name.update.placeholder": "Custom name",
"subscription.rotation.update.label": "Setup secret rotation",
"subscription.reset.secret.label": "Reset secret",
"subscription.show.aggregate.label": "Show aggregate",
Expand Down Expand Up @@ -1479,8 +1479,8 @@
"login.required": "Login required",
"subscription.retrieve.login.required.message": "Please log in to continue. You need to be authenticated to access this feature.",
"subscription.retrieve.token.unavalaible": "token unavailable",
"Daikoku.home" : "Daikoku home",
"API.list" : "APIs list",
"Daikoku.home": "Daikoku home",
"API.list": "APIs list",
"more.nav.options": "More options",
"api.access.modal.title": "Api access request",
"subscription.copy.basic.auth.label": "basic auth.",
Expand All @@ -1490,13 +1490,12 @@
"subscription.copy.token.label": "token",
"subscription.copy.token.help": "Copy daikoku token, used for retrieve credentials by API",
"api.home.config.api.aria.label": "Configuration",
"api.home.update.api.btn.label": "Edit Api configuration",
"api.home.clone.api.btn.label": "Duplicate Api configuration",
"api.home.update.api.btn.label": "Edit",
"api.home.clone.api.btn.label": "Duplicate",
"api.home.create.version.api.btn.label": "Create new version",
"api.home.transfer.api.btn.label": "Transfer",
"api.home.delete.api.btn.label": "Delete",
"api.home.update.description.btn.label": "Update description",
"api.home.update.api.form.title": "Update %s Api information",
"api.home.create.api.form.title": "Create new Api",
"api.home.transfer.api.form.title": "Transfer %s ownership",
"api.home.update.description.form.title": "Update Api description",
Expand All @@ -1513,5 +1512,28 @@
"usage.plan.form.pricing.selector.true.label": "With fees",
"usage.plan.form.pricing.selector.true.description": "Set prices to access the API, with advanced options.",
"usage.plan.form.pricing.selector.false.label": "Free",
"usage.plan.form.pricing.selector.false.description": "Consumers access the API free of charge."
"usage.plan.form.pricing.selector.false.description": "Consumers access the API free of charge.",
"usage.plan.form.quotas.flow.label": "Quotas configuration",
"usage.plan.form.billing.flow.label": "Pricing configuration",
"usage.plan.form.customization.flow.label": "API keys configuration",
"usage.plan.form.description.help": "A brief presentation of the plan, visible to users.",
"usage.plan.form.authorized.teams.help": "the visibility of the plan is set to private. Specify the teams authorized to access in addition to the admin team.",
"usage.plan.form.max.request.second.label": "Max requests per second",
"usage.plan.form.max.request.second.help": "Sets the maximum number of requests per second allowed for the generated API key (can be adjusted later).",
"usage.plan.form.max.request.day.label": "Max requests per day",
"usage.plan.form.max.request.day.help": "Sets the maximum number of requests per day allowed for the generated API key (can be adjusted later).",
"usage.plan.form.max.request.month.label": "Max requests per month",
"usage.plan.form.max.request.month.help": "Sets the maximum number of requests per month allowed for the generated API key (can be adjusted later).",
"usage.plan.form.max.request.placeholder": "Enter a positive integer",
"usage.plan.form.third.party.payment.help": "Choose an available third party payment provider, or use Daikoku's APIs to retrieve billing information if none is selected.",
"usage.plan.form.cost.per.period.help": "Set the subscription cost for the selected billing period.",
"usage.plan.form.cost.per.request.help": "Set the cost per request, to charge beyond the quotas or directly per use.",
"usage.plan.form.trial.period.help": "Set the trial period during which the customer will not be charged.",
"usage.plan.form.payment.settings.label": "Third-party payment provider",
"usage.plan.form.payment.settings.id.label": "Target",
"update.api.details.panel.title": "API details",
"update.api.description.successful.toast.label": "Description has been succesfully updated",
"api.form.header.flow.label": "Header",
"api.form.cms.header.label": "Custom API header from CMS page",
"api.form.cms.header.help": "Define a custom API header by using a CMS page."
}
34 changes: 28 additions & 6 deletions daikoku/javascript/src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1490,13 +1490,12 @@
"subscription.copy.token.label": "Jeton",
"subscription.copy.token.help": "Copier le jeton Daikoku, utilisable pour récupérer les identifiants par API",
"api.home.config.api.aria.label": "Configuration",
"api.home.update.api.btn.label": "Éditer l'API",
"api.home.clone.api.btn.label": "Dupliquer l'API",
"api.home.update.api.btn.label": "Éditer",
"api.home.clone.api.btn.label": "Dupliquer",
"api.home.create.version.api.btn.label": "Créer une nouvelle version",
"api.home.transfer.api.btn.label": "Transférer l'API",
"api.home.delete.api.btn.label": "Supprimer l'API",
"api.home.transfer.api.btn.label": "Transférer",
"api.home.delete.api.btn.label": "Supprimer",
"api.home.update.description.btn.label": "Éditer la description",
"api.home.update.api.form.title": "Éditer l'API - %s",
"api.home.create.api.form.title": "Créer une nouvelle API",
"api.home.transfer.api.form.title": "Transférer l'API %s ",
"api.home.update.description.form.title": "Éditer la description de l'API",
Expand All @@ -1513,5 +1512,28 @@
"usage.plan.form.pricing.selector.true.label": "Avec frais",
"usage.plan.form.pricing.selector.true.description": "Définissez des tarifs pour accéder à l'API, avec des options avancées.",
"usage.plan.form.pricing.selector.false.label": "Gratuit",
"usage.plan.form.pricing.selector.false.description": "Les consommateurs accèdent à l'API sans frais."
"usage.plan.form.pricing.selector.false.description": "Les consommateurs accèdent à l'API sans frais.",
"usage.plan.form.quotas.flow.label": "Configuration des quotas",
"usage.plan.form.billing.flow.label": "Configuration des tarifs",
"usage.plan.form.customization.flow.label": "Configuration des clés API",
"usage.plan.form.description.help": "Une brève présentation du plan, visible par les utilisateurs.",
"usage.plan.form.authorized.teams.help": "La visibilité du plan est définie sur privée. Précisez les équipes autorisées à y accéder, en plus de l'équipe administratrice.",
"usage.plan.form.max.request.second.label": "Max requêtes par seconde",
"usage.plan.form.max.request.second.help": "Définit le nombre maximal de requêtes par seconde autorisées pour la clé API générée (peut être ajusté ultérieurement).",
"usage.plan.form.max.request.day.label": "Max requêtes par jour",
"usage.plan.form.max.request.day.help": "Définit le nombre maximal de requêtes par jour autorisées pour la clé API générée (peut être ajusté ultérieurement).",
"usage.plan.form.max.request.month.label": "Max requêtes par mois",
"usage.plan.form.max.request.month.help": "Définit le nombre maximal de requêtes par mois autorisées pour la clé API générée (peut être ajusté ultérieurement).",
"usage.plan.form.max.request.placeholder": "Entrez un entier positif",
"usage.plan.form.third.party.payment.help": "Choisissez un fournisseur de paiement tiers disponible, ou utilisez les APIs de Daikoku pour récupérer les informations de facturation si aucun n'est sélectionné.",
"usage.plan.form.cost.per.period.help": "Définissez le coût de l'abonnement pour la période de facturation sélectionnée.",
"usage.plan.form.cost.per.request.help": "Définissez le coût par requête, pour facturer au-delà des quotas ou directement par utilisation.",
"usage.plan.form.trial.period.help": "Définissez la période d'essai pendant laquelle le client ne sera pas facturé.",
"usage.plan.form.payment.settings.label": "Fournisseur de paiement tiers",
"usage.plan.form.payment.settings.id.label": "Cible",
"update.api.details.panel.title": "Details de l'API",
"update.api.description.successful.toast.label": "La description a été modifée avec succès.",
"api.form.header.flow.label": "Entête",
"api.form.cms.header.label": "En-tête d'API personnalisé à partir de la page CMS",
"api.form.cms.header.help": "Définissez un en-tête d'API personnalisé à l'aide d'une page CMS."
}

0 comments on commit 5b8f992

Please sign in to comment.