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:
2025-12-26 20:28:43 +01:00
parent 731adda897
commit 36a7fac39a
34 changed files with 3061 additions and 44 deletions

View File

@@ -1,3 +1,44 @@
// Translation status enum
export type TranslationStatus = 'pending' | 'approved' | 'needs_update';
// Translation metadata for tracking changes
export type TranslationMetadata = {
lastModifiedGerman?: Date;
fieldsModifiedSinceTranslation?: string[];
};
// Translated recipe type (English version)
export type TranslatedRecipeType = {
short_name: string;
name: string;
description: string;
preamble?: string;
addendum?: string;
note?: string;
category: string;
tags?: string[];
ingredients?: [{
name?: string;
list: [{
name: string;
unit: string;
amount: string;
}]
}];
instructions?: [{
name?: string;
steps: string[];
}];
images?: [{
alt: string;
caption?: string;
}];
translationStatus: TranslationStatus;
lastTranslated?: Date;
changedFields?: string[];
};
// Full recipe model with translations
export type RecipeModelType = {
_id: string;
short_name: string;
@@ -41,6 +82,10 @@ export type RecipeModelType = {
}]
preamble?: String
addendum?: string
translations?: {
en?: TranslatedRecipeType;
};
translationMetadata?: TranslationMetadata;
};
export type BriefRecipeType = {