From 2723f5bed70941b809008e5aeaa9e29c7d13bbf7 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 15 Nov 2025 15:15:01 +0800 Subject: [PATCH] feat: add AI model selection labels and translations for English, Japanese, and Chinese --- .../src/modules/settings/tabs/plan.tsx | 29 +++++++++++++++++-- locales/settings/en.json | 4 +++ locales/settings/ja.json | 3 ++ locales/settings/zh-CN.json | 3 ++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/plan.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/plan.tsx index eb545eb1b..597657af6 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/plan.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/plan.tsx @@ -8,6 +8,7 @@ import { useUserRole, useWhoami } from "@follow/store/user/hooks" import { cn } from "@follow/utils/utils" import NumberFlow from "@number-flow/react" import { useMutation, useQuery } from "@tanstack/react-query" +import type { TFunction } from "i18next" import { useState } from "react" import { useTranslation } from "react-i18next" import { toast } from "sonner" @@ -16,14 +17,38 @@ import type { PaymentFeature, PaymentPlan } from "~/atoms/server-configs" import { useIsPaymentEnabled, useServerConfigs } from "~/atoms/server-configs" import { subscription } from "~/lib/auth" +const AI_MODEL_SELECTION_VALUE_LABELS = { + none: { + translationKey: "plan.featureValues.AI_MODEL_SELECTION.none", + fallback: "—", + }, + curated: { + translationKey: "plan.featureValues.AI_MODEL_SELECTION.curated", + fallback: "Curated best-value models", + }, + high_performance: { + translationKey: "plan.featureValues.AI_MODEL_SELECTION.high_performance", + fallback: "All high-performance models", + }, +} as const + const formatFeatureValue = ( key: keyof PaymentFeature, - value: number | boolean | string | string[] | null | undefined, + value: PaymentFeature[keyof PaymentFeature] | null | undefined, + t?: TFunction<"settings">, ): string => { if (value == null || value === undefined) { return "—" } + if (key === "AI_MODEL_SELECTION" && typeof value === "string") { + const selectionValue = + AI_MODEL_SELECTION_VALUE_LABELS[value as keyof typeof AI_MODEL_SELECTION_VALUE_LABELS] + if (selectionValue) { + return t?.(selectionValue.translationKey) ?? selectionValue.fallback + } + } + if (typeof value === "boolean") { return value ? "✓" : "—" } @@ -542,7 +567,7 @@ const PlanComparisonTable = ({ plans }: { plans: PaymentPlan[] }) => { {plans.map((plan) => { const value = plan.limit[featureKey] - const formattedValue = formatFeatureValue(featureKey, value) + const formattedValue = formatFeatureValue(featureKey, value, t) return (