From f9db5f9a74b23312fb73c47eabde0ac582f0875f Mon Sep 17 00:00:00 2001
From: mukimovd <41473651-mukimovd@users.noreply.replit.com>
Date: Wed, 7 May 2025 23:58:09 +0000
Subject: [PATCH] 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
---
client/src/pages/works/SimpleWorkReading.tsx | 7 ++++-
server/storage.ts | 31 ++++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/client/src/pages/works/SimpleWorkReading.tsx b/client/src/pages/works/SimpleWorkReading.tsx
index 0edf1f0..487b24c 100644
--- a/client/src/pages/works/SimpleWorkReading.tsx
+++ b/client/src/pages/works/SimpleWorkReading.tsx
@@ -683,7 +683,7 @@ export default function SimpleWorkReading() {
Parallel View
Select a second translation to enable parallel view
- {translations && translations.length > 0 && (
+ {translations && translations.length > 0 ? (
{translations
.filter(t => t.id !== selectedTranslationId)
@@ -700,6 +700,11 @@ export default function SimpleWorkReading() {
))
}
+ ) : (
+
+
No translations available for this work.
+
Try another work or check back later as we add more translations.
+
)}
)}
diff --git a/server/storage.ts b/server/storage.ts
index 9bae22e..117ace5 100644
--- a/server/storage.ts
+++ b/server/storage.ts
@@ -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",