mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 13:34:33 +00:00
refactor(i18n): address code review feedback on string legos, hardcoded locales, and fragile checks
This commit is contained in:
@@ -345,7 +345,9 @@ export const MessageCard: React.FC<MessageCardProps> = ({
|
|||||||
badgeColor = msg.isError
|
badgeColor = msg.isError
|
||||||
? 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
|
? 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
|
||||||
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300'
|
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300'
|
||||||
roleName = `${m.tool_result()} ${String(msg.toolName || m.unknown())}`
|
roleName = m.tool_result_with_name({
|
||||||
|
name: String(msg.toolName || m.unknown()),
|
||||||
|
})
|
||||||
} else if (msg.role === 'thought') {
|
} else if (msg.role === 'thought') {
|
||||||
badgeColor =
|
badgeColor =
|
||||||
'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300'
|
'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300'
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
|
|||||||
{replyingTo && (
|
{replyingTo && (
|
||||||
<div className="flex items-center justify-between bg-muted p-2 px-3 rounded-lg border border-border">
|
<div className="flex items-center justify-between bg-muted p-2 px-3 rounded-lg border border-border">
|
||||||
<div className="text-xs text-muted-foreground truncate mr-2">
|
<div className="text-xs text-muted-foreground truncate mr-2">
|
||||||
{m.reply_to()} {replyingTo.message}
|
{m.reply_to_message({ message: replyingTo.message || '' })}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={onCancelReply}
|
onClick={onCancelReply}
|
||||||
|
|||||||
@@ -293,8 +293,11 @@ export function FileCard({
|
|||||||
className="h-auto p-0 text-sm text-foreground !bg-transparent"
|
className="h-auto p-0 text-sm text-foreground !bg-transparent"
|
||||||
/>
|
/>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{displayItem.createdAt && formatTimeAgo(displayItem.createdAt)} {m.by()}{' '}
|
{displayItem.createdAt &&
|
||||||
{displayItem.creator?.name}
|
m.created_by_at({
|
||||||
|
time: formatTimeAgo(displayItem.createdAt),
|
||||||
|
author: displayItem.creator?.name || m.unknown_user(),
|
||||||
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<DropdownMenu modal={false}>
|
<DropdownMenu modal={false}>
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ export function FileBrowserToolbar({
|
|||||||
open={isMembersDialogOpen}
|
open={isMembersDialogOpen}
|
||||||
onOpenChange={handleOpenMembersDialog}
|
onOpenChange={handleOpenMembersDialog}
|
||||||
title={m.project_members()}
|
title={m.project_members()}
|
||||||
|
type="project"
|
||||||
members={members || []}
|
members={members || []}
|
||||||
isOwner={me?.role === 'owner'}
|
isOwner={me?.role === 'owner'}
|
||||||
onInvite={handleInvite}
|
onInvite={handleInvite}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ interface MembersDialogProps {
|
|||||||
currentUserId?: string
|
currentUserId?: string
|
||||||
availableMembersToAdd?: Member[]
|
availableMembersToAdd?: Member[]
|
||||||
onAddMember?: (userId: string, role: 'editor' | 'reviewer') => Promise<void>
|
onAddMember?: (userId: string, role: 'editor' | 'reviewer') => Promise<void>
|
||||||
|
type?: 'project' | 'team'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MembersDialog({
|
export function MembersDialog({
|
||||||
@@ -58,6 +59,7 @@ export function MembersDialog({
|
|||||||
currentUserId,
|
currentUserId,
|
||||||
availableMembersToAdd,
|
availableMembersToAdd,
|
||||||
onAddMember,
|
onAddMember,
|
||||||
|
type = 'team',
|
||||||
}: MembersDialogProps) {
|
}: MembersDialogProps) {
|
||||||
const [inviteRole, setInviteRole] = useState<'editor' | 'reviewer'>('editor')
|
const [inviteRole, setInviteRole] = useState<'editor' | 'reviewer'>('editor')
|
||||||
const [inviteLink, setInviteLink] = useState<string | null>(null)
|
const [inviteLink, setInviteLink] = useState<string | null>(null)
|
||||||
@@ -256,10 +258,7 @@ export function MembersDialog({
|
|||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
{m.remove_member_confirmation({
|
{m.remove_member_confirmation({
|
||||||
name: memberToRemove?.name || '',
|
name: memberToRemove?.name || '',
|
||||||
type:
|
type: type === 'project' ? m.project() : m.team(),
|
||||||
title.toLowerCase().includes('project') || title.includes('项目')
|
|
||||||
? m.project()
|
|
||||||
: m.team(),
|
|
||||||
})}
|
})}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
|
|||||||
@@ -3,12 +3,35 @@ import { formatTimeAgo } from '@/ui/lib/time'
|
|||||||
import { cn } from '@/ui/lib/utils'
|
import { cn } from '@/ui/lib/utils'
|
||||||
import { SpriteScrubber } from './sprite-scrubber'
|
import { SpriteScrubber } from './sprite-scrubber'
|
||||||
import { m } from '@/ui/paraglide/messages.js'
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
import { getLocale } from '@/ui/paraglide/runtime.js'
|
import React from 'react'
|
||||||
|
|
||||||
interface NotificationCardProps {
|
interface NotificationCardProps {
|
||||||
notification: NotificationInfo
|
notification: NotificationInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const renderNotification = (
|
||||||
|
messageTemplate: string,
|
||||||
|
placeholders: Record<string, React.ReactNode>,
|
||||||
|
) => {
|
||||||
|
const regex = new RegExp(
|
||||||
|
`(${Object.keys(placeholders)
|
||||||
|
.map((k) => `\\{${k}\\}`)
|
||||||
|
.join('|')})`,
|
||||||
|
'g',
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<span>
|
||||||
|
{messageTemplate.split(regex).map((part, index) => {
|
||||||
|
const match = part.match(/^\{(.+)\}$/)
|
||||||
|
if (match && placeholders[match[1]]) {
|
||||||
|
return <React.Fragment key={index}>{placeholders[match[1]]}</React.Fragment>
|
||||||
|
}
|
||||||
|
return part
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export const NotificationCard = ({ notification }: NotificationCardProps) => {
|
export const NotificationCard = ({ notification }: NotificationCardProps) => {
|
||||||
const { creator, createdAt, isRead, type, asset, project, team, user } = notification
|
const { creator, createdAt, isRead, type, asset, project, team, user } = notification
|
||||||
|
|
||||||
@@ -19,90 +42,52 @@ export const NotificationCard = ({ notification }: NotificationCardProps) => {
|
|||||||
const teamName = team?.name || m.unknown_team()
|
const teamName = team?.name || m.unknown_team()
|
||||||
const targetUserName = user?.name || m.unknown_user()
|
const targetUserName = user?.name || m.unknown_user()
|
||||||
|
|
||||||
const isZh = getLocale() === 'zh'
|
const placeholders = {
|
||||||
const creatorEl = <span className="font-semibold">{creatorName}</span>
|
creator: <span className="font-semibold">{creatorName}</span>,
|
||||||
const assetEl = <span className="font-semibold">{assetName}</span>
|
asset: <span className="font-semibold">{assetName}</span>,
|
||||||
const projectEl = <span className="font-semibold">{projectName}</span>
|
project: <span className="font-semibold">{projectName}</span>,
|
||||||
const teamEl = <span className="font-semibold">{teamName}</span>
|
team: <span className="font-semibold">{teamName}</span>,
|
||||||
const userEl = <span className="font-semibold">{targetUserName}</span>
|
user: <span className="font-semibold">{targetUserName}</span>,
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'comment_created':
|
case 'comment_created':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_commented_on({ creator: '{creator}', asset: '{asset}' }),
|
||||||
{creatorEl} 评论了 {assetEl}
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{creatorEl} commented on {assetEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'reply_created':
|
case 'reply_created':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_replied_to({ creator: '{creator}', asset: '{asset}' }),
|
||||||
{creatorEl} 回复了 {assetEl} 上的评论
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{creatorEl} replied to a comment on {assetEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'mention':
|
case 'mention':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_mentioned_you({ creator: '{creator}', asset: '{asset}' }),
|
||||||
{creatorEl} 在 {assetEl} 中提及了你
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{creatorEl} mentioned you in {assetEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'successful_file_uploaded':
|
case 'successful_file_uploaded':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_uploaded({ creator: '{creator}', asset: '{asset}', project: '{project}' }),
|
||||||
{creatorEl} 将 {assetEl} 上传到 {projectEl}
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{creatorEl} uploaded {assetEl} to {projectEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'metadata_field_updated_status':
|
case 'metadata_field_updated_status':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_status_updated({ creator: '{creator}', asset: '{asset}' }),
|
||||||
{creatorEl} 更新了 {assetEl} 的状态
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{creatorEl} updated status of {assetEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'new_user_join_team':
|
case 'new_user_join_team':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_joined_team({ user: '{user}', team: '{team}' }),
|
||||||
{userEl} 加入了 {teamEl}
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{userEl} joined {teamEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
case 'new_user_join_project':
|
case 'new_user_join_project':
|
||||||
return isZh ? (
|
return renderNotification(
|
||||||
<span>
|
m.notification_joined_project({ user: '{user}', project: '{project}' }),
|
||||||
{userEl} 加入了 {projectEl}
|
placeholders,
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{userEl} joined {projectEl}
|
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
return isZh ? (
|
return renderNotification(m.notification_generic({ creator: '{creator}' }), placeholders)
|
||||||
<span>来自 {creatorEl} 的新通知</span>
|
|
||||||
) : (
|
|
||||||
<span>New notification from {creatorEl}</span>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { format, parseISO, isToday, isYesterday } from 'date-fns'
|
|||||||
import { Progress } from '@/ui/components/ui/progress'
|
import { Progress } from '@/ui/components/ui/progress'
|
||||||
import { formatTimeAgo } from '@/ui/lib/time'
|
import { formatTimeAgo } from '@/ui/lib/time'
|
||||||
import { m } from '@/ui/paraglide/messages.js'
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
import { getLocale } from '@/ui/paraglide/runtime.js'
|
|
||||||
|
|
||||||
function formatDayHeader(dateString: string): string {
|
function formatDayHeader(dateString: string): string {
|
||||||
const date = parseISO(dateString)
|
const date = parseISO(dateString)
|
||||||
@@ -23,7 +22,7 @@ function formatDayHeader(dateString: string): string {
|
|||||||
if (isYesterday(date)) {
|
if (isYesterday(date)) {
|
||||||
return m.yesterday()
|
return m.yesterday()
|
||||||
}
|
}
|
||||||
return format(date, getLocale() === 'zh' ? 'yyyy年M月d日' : 'MMMM d, yyyy')
|
return format(date, m.date_format_long())
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBytes(bytes: number): string {
|
function formatBytes(bytes: number): string {
|
||||||
|
|||||||
@@ -813,5 +813,9 @@
|
|||||||
"yesterday_with_time": "Yesterday {time}",
|
"yesterday_with_time": "Yesterday {time}",
|
||||||
"n_items_singular": "{count} Item",
|
"n_items_singular": "{count} Item",
|
||||||
"n_items_plural": "{count} Items",
|
"n_items_plural": "{count} Items",
|
||||||
"fullscreen": "Fullscreen"
|
"fullscreen": "Fullscreen",
|
||||||
|
"created_by_at": "{time} by {author}",
|
||||||
|
"date_format_long": "MMMM d, yyyy",
|
||||||
|
"tool_result_with_name": "Tool Result: {name}",
|
||||||
|
"reply_to_message": "reply to: {message}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -813,5 +813,9 @@
|
|||||||
"yesterday_with_time": "昨天 {time}",
|
"yesterday_with_time": "昨天 {time}",
|
||||||
"n_items_singular": "{count} 个项目",
|
"n_items_singular": "{count} 个项目",
|
||||||
"n_items_plural": "{count} 个项目",
|
"n_items_plural": "{count} 个项目",
|
||||||
"fullscreen": "全屏"
|
"fullscreen": "全屏",
|
||||||
|
"created_by_at": "{time} 由 {author} 创建",
|
||||||
|
"date_format_long": "yyyy年M月d日",
|
||||||
|
"tool_result_with_name": "工具结果:{name}",
|
||||||
|
"reply_to_message": "回复:{message}"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -761,4 +761,8 @@ export * from "./yesterday_with_time.js";
|
|||||||
export * from "./n_items_singular.js";
|
export * from "./n_items_singular.js";
|
||||||
export * from "./n_items_plural.js";
|
export * from "./n_items_plural.js";
|
||||||
export * from "./fullscreen.js";
|
export * from "./fullscreen.js";
|
||||||
|
export * from "./created_by_at.js";
|
||||||
|
export * from "./date_format_long.js";
|
||||||
|
export * from "./tool_result_with_name.js";
|
||||||
|
export * from "./reply_to_message.js";
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
|||||||
+4
@@ -763,3 +763,7 @@ export * from './yesterday_with_time.js'
|
|||||||
export * from './n_items_singular.js'
|
export * from './n_items_singular.js'
|
||||||
export * from './n_items_plural.js'
|
export * from './n_items_plural.js'
|
||||||
export * from './fullscreen.js'
|
export * from './fullscreen.js'
|
||||||
|
export * from './created_by_at.js'
|
||||||
|
export * from './date_format_long.js'
|
||||||
|
export * from './tool_result_with_name.js'
|
||||||
|
export * from './reply_to_message.js'
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{time} by {author}" |
|
||||||
|
*
|
||||||
|
* @param {Created_By_AtInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const created_by_at: ((inputs: Created_By_AtInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Created_By_AtInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Created_By_AtInputs = {
|
||||||
|
time: NonNullable<unknown>;
|
||||||
|
author: NonNullable<unknown>;
|
||||||
|
};
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ time: NonNullable<unknown>, author: NonNullable<unknown> }} Created_By_AtInputs */
|
||||||
|
|
||||||
|
const en_created_by_at = /** @type {(inputs: Created_By_AtInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.time} by ${i?.author}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_created_by_at = /** @type {(inputs: Created_By_AtInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.time} 由 ${i?.author} 创建`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{time} by {author}" |
|
||||||
|
*
|
||||||
|
* @param {Created_By_AtInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const created_by_at = /** @type {((inputs: Created_By_AtInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Created_By_AtInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_created_by_at(inputs)
|
||||||
|
return zh_created_by_at(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "MMMM d, yyyy" |
|
||||||
|
*
|
||||||
|
* @param {Date_Format_LongInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const date_format_long: ((inputs?: Date_Format_LongInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Date_Format_LongInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Date_Format_LongInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Date_Format_LongInputs */
|
||||||
|
|
||||||
|
const en_date_format_long = /** @type {(inputs: Date_Format_LongInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`MMMM d, yyyy`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_date_format_long = /** @type {(inputs: Date_Format_LongInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`yyyy年M月d日`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "MMMM d, yyyy" |
|
||||||
|
*
|
||||||
|
* @param {Date_Format_LongInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const date_format_long = /** @type {((inputs?: Date_Format_LongInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Date_Format_LongInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_date_format_long(inputs)
|
||||||
|
return zh_date_format_long(inputs)
|
||||||
|
});
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "reply to: {message}" |
|
||||||
|
*
|
||||||
|
* @param {Reply_To_MessageInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const reply_to_message: ((inputs: Reply_To_MessageInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Reply_To_MessageInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Reply_To_MessageInputs = {
|
||||||
|
message: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ message: NonNullable<unknown> }} Reply_To_MessageInputs */
|
||||||
|
|
||||||
|
const en_reply_to_message = /** @type {(inputs: Reply_To_MessageInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`reply to: ${i?.message}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_reply_to_message = /** @type {(inputs: Reply_To_MessageInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`回复:${i?.message}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "reply to: {message}" |
|
||||||
|
*
|
||||||
|
* @param {Reply_To_MessageInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const reply_to_message = /** @type {((inputs: Reply_To_MessageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Reply_To_MessageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_reply_to_message(inputs)
|
||||||
|
return zh_reply_to_message(inputs)
|
||||||
|
});
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Tool Result: {name}" |
|
||||||
|
*
|
||||||
|
* @param {Tool_Result_With_NameInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const tool_result_with_name: ((inputs: Tool_Result_With_NameInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Tool_Result_With_NameInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Tool_Result_With_NameInputs = {
|
||||||
|
name: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ name: NonNullable<unknown> }} Tool_Result_With_NameInputs */
|
||||||
|
|
||||||
|
const en_tool_result_with_name = /** @type {(inputs: Tool_Result_With_NameInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`Tool Result: ${i?.name}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_tool_result_with_name = /** @type {(inputs: Tool_Result_With_NameInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`工具结果:${i?.name}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Tool Result: {name}" |
|
||||||
|
*
|
||||||
|
* @param {Tool_Result_With_NameInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const tool_result_with_name = /** @type {((inputs: Tool_Result_With_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Tool_Result_With_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_tool_result_with_name(inputs)
|
||||||
|
return zh_tool_result_with_name(inputs)
|
||||||
|
});
|
||||||
@@ -476,6 +476,7 @@ function TeamPage() {
|
|||||||
open={isMembersDialogOpen}
|
open={isMembersDialogOpen}
|
||||||
onOpenChange={setIsMembersDialogOpen}
|
onOpenChange={setIsMembersDialogOpen}
|
||||||
title={m.team_members()}
|
title={m.team_members()}
|
||||||
|
type="team"
|
||||||
members={safeMembers}
|
members={safeMembers}
|
||||||
isOwner={me?.role === 'owner'}
|
isOwner={me?.role === 'owner'}
|
||||||
onInvite={handleInvite}
|
onInvite={handleInvite}
|
||||||
|
|||||||
Reference in New Issue
Block a user