Show available translations to allow users to select a secondary language

Adds translation options to SimpleWorkReading and seed translations in storage.ts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: cbacfb18-842a-4116-a907-18c0105ad8ec
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/14db3b3e-24d2-4071-aaf1-9c1dcb22c2d7.jpg
This commit is contained in:
mukimovd 2025-05-07 23:58:09 +00:00
parent 8b07e241dd
commit f9db5f9a74
2 changed files with 37 additions and 1 deletions

View File

@ -683,7 +683,7 @@ export default function SimpleWorkReading() {
<h3 className="text-lg font-medium mb-4">Parallel View</h3>
<p className="text-muted-foreground mb-6">Select a second translation to enable parallel view</p>
{translations && translations.length > 0 && (
{translations && translations.length > 0 ? (
<div className="flex flex-wrap justify-center gap-2 max-w-md mx-auto">
{translations
.filter(t => t.id !== selectedTranslationId)
@ -700,6 +700,11 @@ export default function SimpleWorkReading() {
))
}
</div>
) : (
<div className="text-center">
<p className="text-muted-foreground mb-4">No translations available for this work.</p>
<p className="text-sm text-muted-foreground">Try another work or check back later as we add more translations.</p>
</div>
)}
</div>
)}

View File

@ -529,6 +529,37 @@ export class MemStorage implements IStorage {
this.addTagToWork(eugeneOnegin.id, novelTag.id);
this.addTagToWork(eugeneOnegin.id, verseTag.id);
// Add translations for Eugene Onegin
const eugeneOneginEnglish = this.createTranslation({
workId: eugeneOnegin.id,
translatorId: translator.id,
language: "English",
year: 1964,
title: "Eugene Onegin (Nabokov Translation)",
content: "Sample content of Nabokov's English translation of Eugene Onegin...",
description: "Vladimir Nabokov's renowned literal translation that focuses on precision and accuracy at the expense of poetic form."
});
const eugeneOneginModernEnglish = this.createTranslation({
workId: eugeneOnegin.id,
translatorId: scholar.id,
language: "English",
year: 2008,
title: "Eugene Onegin (Modern Translation)",
content: "Sample content of a modern English translation of Eugene Onegin...",
description: "A modern translation that attempts to balance accuracy with poetic rhythm and flow."
});
const eugeneOneginFrench = this.createTranslation({
workId: eugeneOnegin.id,
translatorId: translator.id,
language: "French",
year: 1960,
title: "Eugène Onéguine",
content: "Sample content of French translation of Eugene Onegin...",
description: "A French translation that captures the spirit and elegance of Pushkin's original verse novel."
});
const bronzeHorseman = this.createWork({
title: "The Bronze Horseman",
slug: "the-bronze-horseman",