Add translations

This commit is contained in:
abias 2023-05-23 19:31:33 -04:00
parent 7face53efd
commit 98167b50dc

View file

@ -18,7 +18,6 @@ const rateLimitTypes = [
interface RateLimitsProps { interface RateLimitsProps {
handleRateLimit: FormEventHandler<HTMLInputElement>; handleRateLimit: FormEventHandler<HTMLInputElement>;
handleRateLimitPerSecond: FormEventHandler<HTMLInputElement>; handleRateLimitPerSecond: FormEventHandler<HTMLInputElement>;
rateLimitLabel: string;
rateLimitValue?: number; rateLimitValue?: number;
rateLimitPerSecondValue?: number; rateLimitPerSecondValue?: number;
} }
@ -49,14 +48,13 @@ interface RateLimitFormState {
function RateLimits({ function RateLimits({
handleRateLimit, handleRateLimit,
handleRateLimitPerSecond, handleRateLimitPerSecond,
rateLimitLabel,
rateLimitPerSecondValue, rateLimitPerSecondValue,
rateLimitValue, rateLimitValue,
}: RateLimitsProps) { }: RateLimitsProps) {
return ( return (
<div className="form-group row"> <div className="form-group row">
<label className="col-12 col-form-label" htmlFor="rate-limit"> <label className="col-12 col-form-label" htmlFor="rate-limit">
{rateLimitLabel} {i18n.t("rate_limit")}
</label> </label>
<input <input
type="number" type="number"
@ -171,11 +169,11 @@ export default class RateLimitsForm extends Component<
render() { render() {
return ( return (
<form onSubmit={linkEvent(this, submitRateLimitForm)}> <form onSubmit={linkEvent(this, submitRateLimitForm)}>
<h5>Rate Limit Options</h5> <h5>{i18n.t("rate_limit_header")}</h5>
<Tabs <Tabs
tabs={rateLimitTypes.map(rateLimitType => ({ tabs={rateLimitTypes.map(rateLimitType => ({
key: rateLimitType, key: rateLimitType,
label: rateLimitType, label: i18n.t(`rate_limit_${rateLimitType}`),
getNode: () => ( getNode: () => (
<RateLimits <RateLimits
handleRateLimit={linkEvent( handleRateLimit={linkEvent(
@ -186,7 +184,6 @@ export default class RateLimitsForm extends Component<
{ rateLimitType, ctx: this }, { rateLimitType, ctx: this },
handlePerSecondChange handlePerSecondChange
)} )}
rateLimitLabel={i18n.t(`rate_limit_${rateLimitType}`)}
rateLimitValue={this.state.form[rateLimitType]} rateLimitValue={this.state.form[rateLimitType]}
rateLimitPerSecondValue={ rateLimitPerSecondValue={
this.state.form[`${rateLimitType}_per_second`] this.state.form[`${rateLimitType}_per_second`]