diff --git a/src/components/billingInfo.tsx b/src/components/billingInfo.tsx index dcd9873..e680eb0 100644 --- a/src/components/billingInfo.tsx +++ b/src/components/billingInfo.tsx @@ -1,8 +1,10 @@ import { PublicNoteData, cn, getDaysBetweenDatesWithAutoRenewal } from "@/lib/utils" +import { useTranslation } from "react-i18next" import RemainPercentBar from "./RemainPercentBar" export default function BillingInfo({ parsedData }: { parsedData: PublicNoteData }) { + const { t } = useTranslation() if (!parsedData || !parsedData.billingDataMod) { return null } @@ -22,36 +24,44 @@ export default function BillingInfo({ parsedData }: { parsedData: PublicNoteData daysLeftObject = getDaysBetweenDatesWithAutoRenewal(parsedData.billingDataMod) } catch (error) { console.error(error) - return
剩余时间: 计算出错
+ return ( +
+ {t("billingInfo.remaining")}: {t("billingInfo.error")} +
+ ) } } } return daysLeftObject.days >= 0 ? ( <> -
剩余时间: {isNeverExpire ? "永久" : daysLeftObject.days + "天"}
+
+ {t("billingInfo.remaining")}: {isNeverExpire ? t("billingInfo.indefinite") : daysLeftObject.days + " " + t("billingInfo.days")} +
{parsedData.billingDataMod.amount && parsedData.billingDataMod.amount !== "0" && parsedData.billingDataMod.amount !== "-1" ? (

- 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} + {t("billingInfo.price")}: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}

) : parsedData.billingDataMod.amount === "0" ? ( -

免费

+

{t("billingInfo.free")}

) : parsedData.billingDataMod.amount === "-1" ? ( -

按量收费

+

{t("billingInfo.usage-baseed")}

) : null} ) : ( <> -

已过期: {daysLeftObject.days * -1} 天

+

+ {t("billingInfo.expired")}: {daysLeftObject.days * -1} {t("billingInfo.days")} +

{parsedData.billingDataMod.amount && parsedData.billingDataMod.amount !== "0" && parsedData.billingDataMod.amount !== "-1" ? (

- 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} + {t("billingInfo.price")}: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle}

) : parsedData.billingDataMod.amount === "0" ? ( -

免费

+

{t("billingInfo.free")}

) : parsedData.billingDataMod.amount === "-1" ? ( -

按量收费

+

{t("billingInfo.usage-baseed")}

) : null} ) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index f6a5720..2afdaf6 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -105,5 +105,15 @@ "offlineReady": "App ready to work offline", "newContent": "New content available", "reload": "Update" + }, + "billingInfo": { + "remaining": "Remaining", + "error": "error", + "indefinite": "Indefinite", + "expired": "Expired", + "days": "days", + "price": "Price", + "free": "Free", + "usage-baseed": "Usage-based" } } diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json index a07ba8b..4fff743 100644 --- a/src/locales/zh-CN/translation.json +++ b/src/locales/zh-CN/translation.json @@ -105,5 +105,15 @@ "offlineReady": "应用可以离线使用了", "newContent": "发现新版本", "reload": "更新" + }, + "billingInfo": { + "remaining": "剩余天数", + "error": "计算错误", + "indefinite": "永久", + "expired": "已过期", + "days": "天", + "price": "价格", + "free": "免费", + "usage-baseed": "按量计费" } } diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json index 4398f9c..396dcac 100644 --- a/src/locales/zh-TW/translation.json +++ b/src/locales/zh-TW/translation.json @@ -101,5 +101,15 @@ "status": "狀態", "avgDelay": "延遲", "monitorCount": "個監控" + }, + "billingInfo": { + "remaining": "剩餘天數", + "error": "獲取失敗", + "indefinite": "無限期", + "expired": "已過期", + "days": "天", + "price": "價格", + "free": "免費", + "usage-baseed": "按量計費" } }