fix: ensure base recipe references display correctly in English and auto-translate
All checks were successful
CI / update (push) Successful in 1m11s

Fixed three issues with base recipe translation support:

1. Base recipe content not loading in English - English API endpoint now
   populates baseRecipeRef fields to resolve base recipe data
2. itemsBefore/itemsAfter and stepsBefore/stepsAfter not being detected as
   changed - enhanced change detection to properly track all base recipe
   reference fields for re-translation
3. Base recipe name labels showing German text in English view - display
   components now use translated base recipe names as label fallback
This commit is contained in:
2026-01-04 20:45:51 +01:00
parent 545bd97959
commit 7e66445312
4 changed files with 91 additions and 5 deletions

View File

@@ -541,6 +541,30 @@ class DeepLTranslationService {
continue;
}
// Handle base recipe references
if (oldGroup.type === 'reference' || newGroup.type === 'reference') {
// If type changed (reference <-> section), it's definitely changed
if (oldGroup.type !== newGroup.type) {
changes.push({ groupIndex: i, changed: true });
continue;
}
// Both are references - check reference-specific fields
if (oldGroup.type === 'reference' && newGroup.type === 'reference') {
const referenceChanged =
String(oldGroup.baseRecipeRef) !== String(newGroup.baseRecipeRef) ||
oldGroup.includeIngredients !== newGroup.includeIngredients ||
oldGroup.showLabel !== newGroup.showLabel ||
oldGroup.labelOverride !== newGroup.labelOverride ||
JSON.stringify(oldGroup.itemsBefore || []) !== JSON.stringify(newGroup.itemsBefore || []) ||
JSON.stringify(oldGroup.itemsAfter || []) !== JSON.stringify(newGroup.itemsAfter || []);
changes.push({ groupIndex: i, changed: referenceChanged });
continue;
}
}
// Regular section handling
// Check if group name changed
const nameChanged = oldGroup.name !== newGroup.name;
@@ -608,6 +632,30 @@ class DeepLTranslationService {
continue;
}
// Handle base recipe references
if (oldGroup.type === 'reference' || newGroup.type === 'reference') {
// If type changed (reference <-> section), it's definitely changed
if (oldGroup.type !== newGroup.type) {
changes.push({ groupIndex: i, changed: true });
continue;
}
// Both are references - check reference-specific fields
if (oldGroup.type === 'reference' && newGroup.type === 'reference') {
const referenceChanged =
String(oldGroup.baseRecipeRef) !== String(newGroup.baseRecipeRef) ||
oldGroup.includeInstructions !== newGroup.includeInstructions ||
oldGroup.showLabel !== newGroup.showLabel ||
oldGroup.labelOverride !== newGroup.labelOverride ||
JSON.stringify(oldGroup.stepsBefore || []) !== JSON.stringify(newGroup.stepsBefore || []) ||
JSON.stringify(oldGroup.stepsAfter || []) !== JSON.stringify(newGroup.stepsAfter || []);
changes.push({ groupIndex: i, changed: referenceChanged });
continue;
}
}
// Regular section handling
// Check if group name changed
const nameChanged = oldGroup.name !== newGroup.name;