feat: add AI model selection labels and translations for English, Japanese, and Chinese

This commit is contained in:
DIYgod 2025-11-15 15:15:01 +08:00
parent fcb3eacd7d
commit 2723f5bed7
No known key found for this signature in database
4 changed files with 37 additions and 2 deletions

View File

@ -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[] }) => {
</td>
{plans.map((plan) => {
const value = plan.limit[featureKey]
const formattedValue = formatFeatureValue(featureKey, value)
const formattedValue = formatFeatureValue(featureKey, value, t)
return (
<td

View File

@ -559,7 +559,11 @@
"plan.descriptions.free": "Great for beginners.",
"plan.descriptions.plus": "Unlock AI features and more feeds.",
"plan.descriptions.pro": "Full access to the best of Folo.",
"plan.featureValues.AI_MODEL_SELECTION.curated": "Curated models",
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "All high-end models",
"plan.featureValues.AI_MODEL_SELECTION.none": "—",
"plan.features.AI_CREDIT": "AI Chat Credits",
"plan.features.AI_MODEL_SELECTION": "AI Model Selection",
"plan.features.BOOSTS": "Feed Refresh Acceleration",
"plan.features.INTEGRATION_SUPPORTED": "Third-Party Integrations",
"plan.features.MAX_ACTIONS": "Actions",

View File

@ -555,7 +555,10 @@
"plan.descriptions.free": "初心者に最適です。",
"plan.descriptions.plus": "AI機能とより多くのフィードをアンロック。",
"plan.descriptions.pro": "Foloの最高の機能すべてにアクセス。",
"plan.featureValues.AI_MODEL_SELECTION.curated": "厳選モデル",
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "高性能すべて",
"plan.features.AI_CREDIT": "AI Chat クレジット",
"plan.features.AI_MODEL_SELECTION": "AI モデル選択",
"plan.features.BOOSTS": "購読フィードの加速",
"plan.features.INTEGRATION_SUPPORTED": "サードパーティ統合",
"plan.features.MAX_ACTIONS": "自動化アクション",

View File

@ -555,7 +555,10 @@
"plan.descriptions.free": "非常适合初学者。",
"plan.descriptions.plus": "解锁 AI 功能和更多订阅源。",
"plan.descriptions.pro": "完整享受 Folo 的最佳功能。",
"plan.featureValues.AI_MODEL_SELECTION.curated": "精选模型",
"plan.featureValues.AI_MODEL_SELECTION.high_performance": "全部高性能",
"plan.features.AI_CREDIT": "AI Chat 积分",
"plan.features.AI_MODEL_SELECTION": "AI 模型选择",
"plan.features.BOOSTS": "订阅源更新加速",
"plan.features.INTEGRATION_SUPPORTED": "第三方集成",
"plan.features.MAX_ACTIONS": "自动化操作",