fix: detect imported recipe language for Translate button (v0.33.1)
URL import extracts content in the source page's own language (no translation), but never recorded what that language was, so the Translate button's "recipe.language !== my locale" check always saw null and showed the button unconditionally. The extractor now returns a detected ISO 639-1 language code alongside the recipe. Photo import always writes in the caller's locale already (see its langInstruction) but never recorded that either — now sets it directly to locale since it's known, not detected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,12 @@ export async function POST(req: NextRequest) {
|
||||
cookMins: recipe.cookMins,
|
||||
dietaryTags: recipe.dietaryTags ?? {},
|
||||
aiGenerated: true,
|
||||
// The extraction prompt always writes the recipe in the caller's own
|
||||
// locale (see importFromPhoto's langInstruction) regardless of what
|
||||
// language the photo/label was in — so this *is* the recipe's
|
||||
// language, not a guess, and lets the Translate button correctly
|
||||
// stay hidden until the user's app language changes.
|
||||
language: locale,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user