add English translation support for recipes with DeepL integration
- Add embedded translations schema to Recipe model with English support - Create DeepL translation service with batch translation and change detection - Build translation approval UI with side-by-side editing for all recipe fields - Integrate translation workflow into add/edit pages with field comparison - Create complete English recipe routes at /recipes/* mirroring German structure - Add language switcher component with hreflang SEO tags - Support image loading from German short_name for English recipes - Add English API endpoints for all recipe filters (category, tag, icon, season) - Include layout with English navigation header for all recipe subroutes
This commit is contained in:
@@ -39,7 +39,53 @@ const RecipeSchema = new mongoose.Schema(
|
||||
steps: [String]}],
|
||||
preamble : String,
|
||||
addendum : String,
|
||||
|
||||
// English translations
|
||||
translations: {
|
||||
en: {
|
||||
short_name: {type: String}, // English slug for URLs
|
||||
name: {type: String},
|
||||
description: {type: String},
|
||||
preamble: {type: String},
|
||||
addendum: {type: String},
|
||||
note: {type: String},
|
||||
category: {type: String},
|
||||
tags: [String],
|
||||
ingredients: [{
|
||||
name: {type: String, default: ""},
|
||||
list: [{
|
||||
name: {type: String, default: ""},
|
||||
unit: String,
|
||||
amount: String,
|
||||
}]
|
||||
}],
|
||||
instructions: [{
|
||||
name: {type: String, default: ""},
|
||||
steps: [String]
|
||||
}],
|
||||
images: [{
|
||||
alt: String,
|
||||
caption: String,
|
||||
}],
|
||||
translationStatus: {
|
||||
type: String,
|
||||
enum: ['pending', 'approved', 'needs_update'],
|
||||
default: 'pending'
|
||||
},
|
||||
lastTranslated: {type: Date},
|
||||
changedFields: [String],
|
||||
}
|
||||
},
|
||||
|
||||
// Translation metadata for tracking changes
|
||||
translationMetadata: {
|
||||
lastModifiedGerman: {type: Date},
|
||||
fieldsModifiedSinceTranslation: [String],
|
||||
},
|
||||
}, {timestamps: true}
|
||||
);
|
||||
|
||||
// Indexes for efficient querying
|
||||
RecipeSchema.index({ "translations.en.short_name": 1 });
|
||||
|
||||
export const Recipe = mongoose.model("Recipe", RecipeSchema);
|
||||
|
||||
Reference in New Issue
Block a user