Refactor and enhance localization support; update language files and improve validation messages
- Updated localization files for Arabic and Traditional Chinese (Hong Kong). - Added Arabic language support in the i18n configuration. - Improved validation messages in the withdrawal schema. - Refactored Vue components to ensure consistent usage of translation functions. - Cleaned up CSS files for better formatting and consistency.
This commit is contained in:
@@ -9,33 +9,35 @@ export function createWithdrawSchema(t: (key: string, params?: any) => string, m
|
||||
amount: yup
|
||||
.string()
|
||||
.required(t("withdraw.validation.amountRequired"))
|
||||
.test("is-number", t("withdraw.validation.amountInvalid"), value => {
|
||||
.test("is-number", t("withdraw.validation.amountInvalid"), (value) => {
|
||||
return /^\d+(\.\d+)?$/.test(value || "");
|
||||
})
|
||||
.test("max-amount", t("withdraw.validation.amountExceedsBalance"), value => {
|
||||
if (!value || maxAmount === "0") return false;
|
||||
return parseFloat(value) <= parseFloat(maxAmount);
|
||||
.test("max-amount", t("withdraw.validation.amountExceedsBalance"), (value) => {
|
||||
if (!value || maxAmount === "0")
|
||||
return false;
|
||||
return Number.parseFloat(value) <= Number.parseFloat(maxAmount);
|
||||
})
|
||||
.test("min-amount", t("withdraw.validation.amountTooSmall"), value => {
|
||||
if (!value) return false;
|
||||
return parseFloat(value) > 0;
|
||||
.test("min-amount", t("withdraw.validation.amountTooSmall"), (value) => {
|
||||
if (!value)
|
||||
return false;
|
||||
return Number.parseFloat(value) > 0;
|
||||
}),
|
||||
withdrawMethod: yup.string().required(t("withdraw.validation.methodRequired")),
|
||||
bankAccountId: yup.string().when("withdrawMethod", {
|
||||
is: WithdrawMethodEnum.BANK,
|
||||
then: (schema) => schema.required(t("withdraw.validation.bankAccountRequired")),
|
||||
otherwise: (schema) => schema.optional(),
|
||||
then: schema => schema.required(t("withdraw.validation.bankAccountRequired")),
|
||||
otherwise: schema => schema.optional(),
|
||||
}),
|
||||
chain: yup.string().when("withdrawMethod", {
|
||||
is: WithdrawMethodEnum.CRYPTO,
|
||||
then: (schema) => schema.required(t("withdraw.validation.chainRequired")),
|
||||
otherwise: (schema) => schema.optional(),
|
||||
then: schema => schema.required(t("withdraw.validation.chainRequired")),
|
||||
otherwise: schema => schema.optional(),
|
||||
}),
|
||||
toAddress: yup.string().when("withdrawMethod", {
|
||||
is: WithdrawMethodEnum.CRYPTO,
|
||||
then: (schema) => schema.required(t("withdraw.validation.addressRequired")).min(10, t("withdraw.validation.addressTooShort")),
|
||||
otherwise: (schema) => schema.optional(),
|
||||
then: schema => schema.required(t("withdraw.validation.addressRequired")).min(10, t("withdraw.validation.addressTooShort")),
|
||||
otherwise: schema => schema.optional(),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user