You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(content): opportunities are generated in English regardless of the brand's language #363
When a brand's language is set to something other than English (e.g. Turkish, chosen during onboarding), the Content Optimization opportunities (/dashboard/content) are still generated in English. They should be written in the brand's language.
Root cause (from the code)
The content-opportunity generator never tells the LLM which language to write in — unlike the other AI-generation flows, which already do.
fetches the brand with select('id, name, description, industry, organization_id') — language is not selected;
OPPORTUNITY_SYSTEM_PROMPT and the built userPrompt contain no language instruction;
so generateObject({ system: OPPORTUNITY_SYSTEM_PROMPT, prompt: userPrompt, … }) defaults to English.
For contrast, the flows that do it right: the prompt-suggestion generator resolves getLanguageName(brand.language) and instructs the model to write in that language (see loadSuggestionContext / generateSuggestions in server/src/routes/prompts.js), and the topic/competitor suggestion routes append e.g. IMPORTANT: All … MUST be written in ${langName}.
Proposed change
Mirror the existing pattern in content-worker.js:
Add language to the brand select(...).
import { getLanguageName } from '../lib/languages.js'; and resolve const langName = getLanguageName(brand.language);.
Add a language directive to the generation prompt, e.g. append to the system prompt or the user prompt: IMPORTANT: Write every opportunity title and description in ${langName}.
The opportunity type / impact enums stay as-is (they're internal values, not shown-as-text) — only the human-readable title and description need to be in the brand's language.
How to test
Create/set a brand whose language is Turkish (or any non-English), then generate Content Optimization opportunities.
The generated titles and descriptions come back in that language (Turkish), not English.
An English brand still gets English opportunities (no regression).
Notes
Server-only change in the content generation worker; no schema or web change.
Uses the existing getLanguageName helper and the same convention as prompt/topic/competitor suggestions.
Thanks @Sam-syntax35 — assigned to you! 🎉 In server/src/workers/content-worker.js (processContentJob): add language to the brand select(...), import { getLanguageName } from '../lib/languages.js', resolve const langName = getLanguageName(brand.language), and add a directive to the prompt like IMPORTANT: Write every opportunity title and description in ${langName}. — mirrors the prompt-suggestion / topic-suggestion flows. Only title/description need translating; the type/impact enums stay as-is. Ping here if anything's unclear.
Activity
Sam-syntax35 commentedon Jul 7, 2026
please assign this to me! i willl be happy to contribute on this
gkhngyk commentedon Jul 7, 2026
Thanks @Sam-syntax35 — assigned to you! 🎉 In
server/src/workers/content-worker.js(processContentJob): addlanguageto the brandselect(...),import { getLanguageName } from '../lib/languages.js', resolveconst langName = getLanguageName(brand.language), and add a directive to the prompt likeIMPORTANT: Write every opportunity title and description in ${langName}.— mirrors the prompt-suggestion / topic-suggestion flows. Onlytitle/descriptionneed translating; thetype/impactenums stay as-is. Ping here if anything's unclear.