fix: align spec paths and add missing translation keys

This commit is contained in:
catlog22
2026-03-01 13:42:25 +08:00
parent ecf4e4d848
commit 1f859ae4b9
5 changed files with 2028 additions and 11 deletions

View File

@@ -105,15 +105,15 @@ const eventConfig: Record<
// Event label keys for i18n
const eventLabelKeys: Record<HookEvent, string> = {
SessionStart: 'hooks.events.sessionStart',
UserPromptSubmit: 'hooks.events.userPromptSubmit',
SessionEnd: 'hooks.events.sessionEnd',
SessionStart: 'specs.hook.event.SessionStart',
UserPromptSubmit: 'specs.hook.event.UserPromptSubmit',
SessionEnd: 'specs.hook.event.SessionEnd',
};
// Scope label keys for i18n
const scopeLabelKeys: Record<HookScope, string> = {
global: 'hooks.scope.global',
project: 'hooks.scope.project',
global: 'specs.hook.scope.global',
project: 'specs.hook.scope.project',
};
/**
@@ -136,7 +136,7 @@ export function HookCard({
variant: 'default' as const,
icon: <Zap className="h-3 w-3" />,
};
const eventLabel = formatMessage({ id: eventLabelKeys[hook.event] || 'hooks.events.unknown' });
const eventLabel = formatMessage({ id: eventLabelKeys[hook.event] || 'specs.hook.event.SessionStart' });
const scopeIcon = hook.scope === 'global' ? <Globe className="h-3 w-3" /> : <Folder className="h-3 w-3" />;
const scopeLabel = formatMessage({ id: scopeLabelKeys[hook.scope] });
@@ -194,7 +194,7 @@ export function HookCard({
disabled={actionsDisabled}
className="ml-4"
>
{formatMessage({ id: 'hooks.actions.install' })}
{formatMessage({ id: 'specs.hook.install' })}
</Button>
</div>
</CardContent>
@@ -256,7 +256,7 @@ export function HookCard({
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={(e) => handleAction(e, 'edit')}>
<Edit className="mr-2 h-4 w-4" />
{formatMessage({ id: 'hooks.actions.edit' })}
{formatMessage({ id: 'specs.hook.edit' })}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
@@ -264,7 +264,7 @@ export function HookCard({
className="text-destructive focus:text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
{formatMessage({ id: 'hooks.actions.uninstall' })}
{formatMessage({ id: 'specs.hook.uninstall' })}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>

View File

@@ -309,6 +309,27 @@
"form": {
"readMode": "Read Mode",
"priority": "Priority",
"keywords": "Keywords"
"keywords": "Keywords",
"title": "Title",
"titlePlaceholder": "Enter spec title",
"addKeyword": "Add Keyword",
"keywordsHint": "Keywords help match optional specs to relevant tasks",
"fileInfo": "File: {file}",
"saving": "Saving..."
},
"validation": {
"titleRequired": "Title is required"
},
"dialog": {
"editTitle": "Edit Spec: {title}",
"editDescription": "Modify spec metadata and settings."
},
"hooks": {
"installSuccess": "Hook installed successfully",
"installError": "Failed to install hook",
"installAllSuccess": "All hooks installed successfully"
}
}

View File

@@ -316,6 +316,27 @@
"form": {
"readMode": "读取模式",
"priority": "优先级",
"keywords": "关键词"
"keywords": "关键词",
"title": "标题",
"titlePlaceholder": "输入规范标题",
"addKeyword": "添加关键词",
"keywordsHint": "关键词有助于将选读规范匹配到相关任务",
"fileInfo": "文件:{file}",
"saving": "保存中..."
},
"validation": {
"titleRequired": "标题为必填项"
},
"dialog": {
"editTitle": "编辑规范:{title}",
"editDescription": "修改规范元数据和设置。"
},
"hooks": {
"installSuccess": "钩子安装成功",
"installError": "钩子安装失败",
"installAllSuccess": "所有钩子安装成功"
}
}