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:
2025-12-20 05:30:59 +07:00
parent 11bcbafd6e
commit 3d9785fdf2
16 changed files with 719 additions and 51 deletions

View File

@@ -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(),
}),
}),
);
}
}