mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-17 22:24:29 +00:00
chore(app): i18n sync (#17283)
This commit is contained in:
@@ -322,7 +322,7 @@ export function getToolInfo(tool: string, input: any = {}): ToolInfo {
|
||||
case "skill":
|
||||
return {
|
||||
icon: "brain",
|
||||
title: input.name || "skill",
|
||||
title: input.name || i18n.t("ui.tool.skill"),
|
||||
}
|
||||
default:
|
||||
return {
|
||||
@@ -924,15 +924,12 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
|
||||
const match = data.store.provider?.all?.find((p) => p.id === providerID)
|
||||
return match?.models?.[modelID]?.name ?? modelID
|
||||
})
|
||||
const timefmt = createMemo(() => new Intl.DateTimeFormat(i18n.locale(), { timeStyle: "short" }))
|
||||
|
||||
const stamp = createMemo(() => {
|
||||
const created = props.message.time?.created
|
||||
if (typeof created !== "number") return ""
|
||||
const date = new Date(created)
|
||||
const hours = date.getHours()
|
||||
const hour12 = hours % 12 || 12
|
||||
const minute = String(date.getMinutes()).padStart(2, "0")
|
||||
return `${hour12}:${minute} ${hours < 12 ? "AM" : "PM"}`
|
||||
return timefmt().format(created)
|
||||
})
|
||||
|
||||
const metaHead = createMemo(() => {
|
||||
@@ -1318,6 +1315,7 @@ PART_MAPPING["compaction"] = function CompactionPartDisplay() {
|
||||
PART_MAPPING["text"] = function TextPartDisplay(props) {
|
||||
const data = useData()
|
||||
const i18n = useI18n()
|
||||
const numfmt = createMemo(() => new Intl.NumberFormat(i18n.locale()))
|
||||
const part = () => props.part as TextPart
|
||||
const interrupted = createMemo(
|
||||
() =>
|
||||
@@ -1343,10 +1341,13 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
|
||||
: -1
|
||||
if (!(ms >= 0)) return ""
|
||||
const total = Math.round(ms / 1000)
|
||||
if (total < 60) return `${total}s`
|
||||
if (total < 60) return i18n.t("ui.message.duration.seconds", { count: numfmt().format(total) })
|
||||
const minutes = Math.floor(total / 60)
|
||||
const seconds = total % 60
|
||||
return `${minutes}m ${seconds}s`
|
||||
return i18n.t("ui.message.duration.minutesSeconds", {
|
||||
minutes: numfmt().format(minutes),
|
||||
seconds: numfmt().format(seconds),
|
||||
})
|
||||
})
|
||||
|
||||
const meta = createMemo(() => {
|
||||
@@ -2206,7 +2207,8 @@ ToolRegistry.register({
|
||||
ToolRegistry.register({
|
||||
name: "skill",
|
||||
render(props) {
|
||||
const title = createMemo(() => props.input.name || "skill")
|
||||
const i18n = useI18n()
|
||||
const title = createMemo(() => props.input.name || i18n.t("ui.tool.skill"))
|
||||
const running = createMemo(() => props.status === "pending" || props.status === "running")
|
||||
|
||||
const titleContent = () => <TextShimmer text={title()} active={running()} />
|
||||
|
||||
Reference in New Issue
Block a user