Localize dashboard room protocol labels
This commit is contained in:
@@ -24,8 +24,13 @@ const formatters = {
|
||||
formatDate: (value: string | null | undefined) => value ?? '-',
|
||||
formatDuration: (value: number | null) => (value === null ? '-' : `${value}`),
|
||||
formatLiveElapsed: (value: number) => `${value}`,
|
||||
senderRoleClass: (value: string | null | undefined) =>
|
||||
(value ?? '').toLowerCase().includes('owner') ? 'role-owner' : 'role-human',
|
||||
senderRoleClass: (value: string | null | undefined) => {
|
||||
const role = (value ?? '').toLowerCase();
|
||||
if (role.includes('owner')) return 'role-owner';
|
||||
if (role.includes('reviewer')) return 'role-reviewer';
|
||||
if (role.includes('arbiter')) return 'role-arbiter';
|
||||
return 'role-human';
|
||||
},
|
||||
statusLabel: (status: string) => status,
|
||||
};
|
||||
|
||||
@@ -110,6 +115,51 @@ describe('RoomCardV2', () => {
|
||||
expect(html).toContain('prod 배포 완료');
|
||||
});
|
||||
|
||||
it('localizes protocol role and verdict labels in Korean rooms', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
createElement(RoomCardV2, {
|
||||
activity: activity({
|
||||
pairedTask: {
|
||||
id: 'task-1',
|
||||
title: 'Review pending',
|
||||
status: 'in_review',
|
||||
roundTripCount: 2,
|
||||
updatedAt: '2026-04-28T02:03:00.000Z',
|
||||
currentTurn: null,
|
||||
outputs: [
|
||||
{
|
||||
id: 1,
|
||||
turnNumber: 2,
|
||||
role: 'reviewer',
|
||||
verdict: 'continue',
|
||||
createdAt: '2026-04-28T02:02:00.000Z',
|
||||
outputText: '검증 완료. 다음 단계로 진행 가능합니다.',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
activityLoading: false,
|
||||
busy: false,
|
||||
draft: '',
|
||||
entry,
|
||||
expanded: true,
|
||||
inboxItems: [],
|
||||
locale: 'ko',
|
||||
onDraftChange: () => {},
|
||||
onSendMessage: () => {},
|
||||
onToggle: () => {},
|
||||
pinned: true,
|
||||
t,
|
||||
...formatters,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(html).toContain('>리뷰어</span>');
|
||||
expect(html).toContain('>계속</span>');
|
||||
expect(html).not.toContain('>reviewer</span>');
|
||||
expect(html).not.toContain('>continue</span>');
|
||||
});
|
||||
|
||||
it('renders live progress as markdown', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
createElement(RoomCardV2, {
|
||||
@@ -244,6 +294,7 @@ describe('RoomCardV2', () => {
|
||||
);
|
||||
|
||||
expect(html).toContain('class="room-watcher-fold"');
|
||||
expect(html).toContain('>리뷰어</strong>');
|
||||
expect(html).toContain(watcherTail);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { DashboardOverview, DashboardRoomActivity } from './api';
|
||||
import type { Locale, Messages } from './i18n';
|
||||
import { ParsedBody } from './ParsedBody';
|
||||
import { RoomAttachmentGallery } from './RoomAttachmentGallery';
|
||||
import { displayRole, displayVerdict } from './roomDisplayLabels';
|
||||
import {
|
||||
buildRoomThreadEntries,
|
||||
isWatcherRoomMessage,
|
||||
@@ -421,7 +422,9 @@ function RoomCurrentTurnSummary({
|
||||
return (
|
||||
<div className="room-current-turn">
|
||||
<span>
|
||||
<strong className={senderRoleClass(turn.role)}>{turn.role}</strong>
|
||||
<strong className={senderRoleClass(turn.role)}>
|
||||
{displayRole(turn.role, locale)}
|
||||
</strong>
|
||||
<em>{turn.intentKind}</em>
|
||||
{turn.attemptNo > 1 ? (
|
||||
<small>
|
||||
@@ -504,7 +507,9 @@ function CollapsedLiveTurn({
|
||||
<header>
|
||||
<span className="live-dot" aria-hidden />
|
||||
<span className="live-label">LIVE</span>
|
||||
<strong className={senderRoleClass(turn.role)}>{turn.role}</strong>
|
||||
<strong className={senderRoleClass(turn.role)}>
|
||||
{displayRole(turn.role, locale)}
|
||||
</strong>
|
||||
<em>{turn.intentKind}</em>
|
||||
<span className="live-state pill pill-processing">{turn.state}</span>
|
||||
{turn.executorServiceId ? (
|
||||
@@ -574,7 +579,7 @@ function CollapsedWatcherStrip({
|
||||
<span className="watcher-tag">워쳐 {watcherCount}</span>
|
||||
<span className="watcher-line">
|
||||
<strong className={senderRoleClass(lastWatcher.senderName)}>
|
||||
{lastWatcher.senderName}
|
||||
{displayRole(lastWatcher.senderName, locale)}
|
||||
</strong>
|
||||
<span>{lastWatcher.content.slice(0, 90)}</span>
|
||||
</span>
|
||||
@@ -764,7 +769,7 @@ function RoomTimelineEntry({
|
||||
<li className={`room-timeline-item ${sectionClass}`}>
|
||||
<header className="room-timeline-header">
|
||||
<span className={`role-chip ${senderRoleClass(entry.senderName)}`}>
|
||||
{entry.senderName}
|
||||
{displayRole(entry.senderName, locale)}
|
||||
</span>
|
||||
<time>{formatDate(entry.timestamp, locale)}</time>
|
||||
{entry.turnNumber !== undefined ? (
|
||||
@@ -774,7 +779,7 @@ function RoomTimelineEntry({
|
||||
) : null}
|
||||
{verdict ? (
|
||||
<span className={`parsed-marker parsed-marker-${verdictTone}`}>
|
||||
{verdict}
|
||||
{displayVerdict(verdict, locale)}
|
||||
</span>
|
||||
) : null}
|
||||
</header>
|
||||
@@ -818,7 +823,7 @@ function RoomLiveTimelineEntry({
|
||||
<span className="paused-dot" aria-hidden />
|
||||
)}
|
||||
<span className={`role-chip ${senderRoleClass(turn.role)}`}>
|
||||
{turn.role}
|
||||
{displayRole(turn.role, locale)}
|
||||
</span>
|
||||
<time>
|
||||
{formatDate(turn.progressUpdatedAt ?? turn.updatedAt, locale)}
|
||||
@@ -866,7 +871,7 @@ function RoomWatcherFold({
|
||||
<li className="room-watcher-item" key={message.id}>
|
||||
<header>
|
||||
<strong className={senderRoleClass(message.senderName)}>
|
||||
{message.senderName}
|
||||
{displayRole(message.senderName, locale)}
|
||||
</strong>
|
||||
<time>{formatDate(message.timestamp, locale)}</time>
|
||||
</header>
|
||||
|
||||
34
apps/dashboard/src/roomDisplayLabels.ts
Normal file
34
apps/dashboard/src/roomDisplayLabels.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { Locale } from './i18n';
|
||||
|
||||
const KO_ROLE_LABELS: Record<string, string> = {
|
||||
arbiter: '중재자',
|
||||
owner: '오너',
|
||||
reviewer: '리뷰어',
|
||||
};
|
||||
|
||||
const KO_VERDICT_LABELS: Record<string, string> = {
|
||||
blocked: '차단',
|
||||
continue: '계속',
|
||||
done: '완료',
|
||||
done_with_concerns: '우려 있음',
|
||||
needs_context: '컨텍스트 필요',
|
||||
proceed: '진행',
|
||||
reset: '초기화',
|
||||
revise: '수정 필요',
|
||||
step_done: '단계 완료',
|
||||
task_done: '작업 완료',
|
||||
};
|
||||
|
||||
export function displayRole(
|
||||
value: string | null | undefined,
|
||||
locale: Locale,
|
||||
): string {
|
||||
const raw = value ?? '';
|
||||
if (locale !== 'ko') return raw;
|
||||
return KO_ROLE_LABELS[raw.trim().toLowerCase()] ?? raw;
|
||||
}
|
||||
|
||||
export function displayVerdict(value: string, locale: Locale): string {
|
||||
if (locale !== 'ko') return value;
|
||||
return KO_VERDICT_LABELS[value.trim().toLowerCase()] ?? value;
|
||||
}
|
||||
Reference in New Issue
Block a user