Skip to content

Commit f6161bb

Browse files
committed
feat(ui): Enhance translation result display with human-readable names
- Add displayName field to TranslationResult interface - Update translation runner to populate displayName from targetName - Show displayName in completion dialog instead of raw IDs - Support searching by both ID and displayName in results Improves UX by showing guidebook names instead of job IDs in results.
1 parent b93f509 commit f6161bb

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/components/ui/completion-dialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export function CompletionDialog({
4141
// Filter results for search
4242
const filteredResults = results.filter(result =>
4343
!filterText ||
44-
result.id.toLowerCase().includes(filterText.toLowerCase())
44+
result.id.toLowerCase().includes(filterText.toLowerCase()) ||
45+
(result.displayName && result.displayName.toLowerCase().includes(filterText.toLowerCase()))
4546
);
4647

4748

@@ -145,7 +146,7 @@ export function CompletionDialog({
145146
<XCircle className="h-4 w-4 text-red-500 flex-shrink-0" />
146147
)}
147148
<span className={result.success ? 'text-green-700' : 'text-red-700'}>
148-
{result.id}
149+
{result.displayName || result.id}
149150
</span>
150151
</div>
151152
))

src/lib/services/translation-runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export async function runTranslationJobs<T extends TranslationJob = TranslationJ
109109
onResult({
110110
type,
111111
id: type === "mod" ? (job.currentFileName || job.id) : job.id,
112+
displayName: job.targetName,
112113
targetLanguage,
113114
content,
114115
outputPath,

src/lib/types/minecraft.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ export interface TranslationResult {
133133
type: "mod" | "ftb" | "better" | "patchouli" | "custom";
134134
/** Target ID */
135135
id: string;
136+
/** Display name (optional, used for guidebooks and other items where name differs from ID) */
137+
displayName?: string;
136138
/** Target language */
137139
targetLanguage: string;
138140
/** Translated content */

0 commit comments

Comments
 (0)