I’d handle this as session state rather than trying to re-detect the language in every step. Let the first chat message either ask for the preferred language or detect it, then save that value against the chat/session ID in a Data Store, database, or whatever persistence layer you’re already using. After that, every prompt or translation step can read the saved language and keep replies consistent for the rest of the conversation.
Good Day @Leon22 This is very doable in n8n. Here’s the cleanest way to set it up:
1. Capture language on first message Use a simple IF node to check if a language has already been set in memory. If not, prompt the user to choose. Once they reply, store it.
2. Persist the language using Window Buffer Memory Save the selected language in your chat memory as a system context variable. Something like “The user has selected German. Always respond in German.” this way every subsequent AI call inherits it without asking again.
3. For dynamic translation of HTTP responses and Set node text Pass everything through your AI node with a system prompt that says:
“Always respond in {{ $('Set Language').item.json.language }}”
This handles translation of external API responses and static text automatically no separate translation service needed for most cases.
Best practice summary:
Store language in memory or a Set node at session start
Inject it into every AI system prompt via expression
Let the LLM handle translation rather than adding a separate translation step
Only consider an external service like DeepL if you’re dealing with large structured content where LLM translation feels inconsistent.