All articles Beginner handbook

How to Use AI to Write Natural Code-Switching for Bilingual Characters

Murdok Published August 1, 2026 Updated August 1, 2026 10 min read

Ask most AI models to write a bilingual character and you'll get the same tell every time: a sentence in English, followed by the exact same sentence in Spanish or Mandarin or Yoruba, italicized, like a subtitle track that never turns off. "You're late," she said. Llegaste tarde. Nobody talks like this. Real code-switching isn't translation — it's a completely different cognitive event, and if you want dialogue that sounds like it came from an actual bilingual mouth instead of a language app demo, you have to understand why the model keeps getting it wrong before you can fix your prompts.

Why AI defaults to "translate and italicize" instead of real code-switching

Large language models learn dialogue patterns from published fiction, and a huge chunk of published fiction handles bilingual characters badly — either through the italicize-and-translate crutch, or through "flavor" phrases dropped in for texture (a stray mija or habibi tossed into otherwise monolingual English). The model has absorbed thousands of examples of code-switching used as decoration rather than as the actual mechanism real bilingual people use to navigate a conversation. So when you ask for "a bilingual character," you get decoration.

The deeper problem is that code-switching isn't really about language at all. It's about relationship, context, and emotional load. A person doesn't switch languages because a paragraph needs spicing up — they switch because the emotional register shifted, because the audience in the room changed, because one language holds a memory the other one doesn't. AI has no access to that logic unless you supply it. Left alone, it defaults to the shallowest possible model: two languages exist, so alternate between them decoratively.

Code-switching is a behavior triggered by context, not a stylistic garnish sprinkled over dialogue. If your prompt doesn't specify the trigger, the AI will invent a fake one — usually "for flavor."

This matters more than it might seem, because bilingual readers notice immediately when the pattern is fake. It's one of the fastest ways to break trust with an audience that actually lives in two languages. The fix isn't a magic prompt phrase — it's giving the model an actual linguistic logic to follow, the same way you'd build any other piece of a story bible AI models actually follow: rules, not vibes.


Mapping your character's switch triggers: emotion, audience, topic, and power dynamics

Before you write a single line of prompt, do the unglamorous work of mapping when your character switches and why. Real bilingual speakers switch along predictable seams. Once you identify your character's seams, the AI has something concrete to imitate instead of guessing.

  • Emotion. Many bilingual speakers revert to their first language under stress, anger, or intimacy — the language of childhood carries more emotional voltage. A character who's calm in English might snap into Tagalog the second she's furious.
  • Audience. Code-switching is often about who's listening. A character might speak formal English to a boss, then flip into casual Haitian Creole the moment a cousin walks in — not because the topic changed, but because the audience did.
  • Topic. Some subjects just live in one language for a given speaker. A character raised by Korean-speaking grandparents might only know the words for specific foods, prayers, or scoldings in Korean, even if every other conversation happens in English.
  • Power dynamics. Switching languages can assert dominance, create solidarity, or exclude someone deliberately. A character might switch to French specifically so a monolingual coworker can't follow — the switch itself is the point, not the content.

Write this out as a short reference — three or four bullet points per character — and drop it into whatever system you're using to track continuity. If you're already running an AI book outline or working inside a full story bible, this is exactly the kind of detail that belongs there, because it's the first thing a model forgets across a long manuscript and the first thing a bilingual reader notices when it's missing.

My character Renata is Puerto Rican-American, fluent in both English and Spanish, code-switches based on emotional intensity and audience. Baseline: speaks English at work and with her white boyfriend. Triggers: switches to Spanish when angry, when talking to her mother on the phone, or when comforting someone in pain. Never switches for humor or performance — for her, Spanish is private and vulnerable, not decorative. Write a scene where her boyfriend overhears her arguing with her mother in Spanish, then switches back to English mid-sentence when she notices him in the doorway — show the switch as a visible retreat, not a translation.

This works because it gives the model a rule system (trigger = emotional intensity + audience) and a specific narrative beat (the switch-back as retreat) instead of a vague instruction to "make her bilingual." Swap the languages, the trigger, and the relationship to fit your own cast.


Prompt templates for intra-sentence switches vs. full-line language shifts

Code-switching happens at different grain sizes, and your prompts need to specify which one you want, because the model will otherwise default to the crudest version — swapping whole sentences.

Intra-sentence switching (sometimes called code-mixing) is when a speaker weaves both languages into a single sentence, which is how a lot of real bilingual speech actually works: "I told him no, pero he didn't listen, so now we're stuck here." This is harder for AI to generate convincingly because it requires understanding which words carry more weight in which language — nouns and interjections switch easily; whole grammatical clauses switching mid-sentence often sounds unnatural unless you're modeling a specific, attested pattern like Spanglish or Hinglish.

Full-line shifts are cleaner and easier to control: the character delivers an entire sentence or exchange in one language before shifting to another, usually triggered by the factors you mapped in the last section. This is often the safer default for scenes where you want the switch to carry emotional or narrative weight rather than just texture.

Write a text message exchange between two Mexican-American sisters, Ana and Bel, who text in natural Spanglish — intra-sentence code-mixing, not full sentence swaps. Model it on real Spanglish patterns: English verbs conjugated with Spanish grammar are NOT what I want; instead mix at natural clause boundaries the way bilingual texters actually do ("no manches, that's insane," "ya llegué, dame like 10 minutes"). Keep it casual, funny, a little rushed — they're arguing about who forgot to pick up their mom from the airport. No translations in parentheses, no italics on the Spanish words.

Notice the prompt bans the italics and parenthetical translations up front — you have to say this explicitly, every time, because it's the model's strongest default habit. Also notice it gives concrete example fragments. Models follow demonstrated patterns far better than they follow abstract descriptions like "mix naturally."

Write a scene in a hospital waiting room where Grandpa Wu, who speaks Cantonese as his first language and limited English, is trying to get information from a nurse. His granddaughter Mei is translating. I want full-line shifts, not mixed sentences — Grandpa speaks entirely in Cantonese (rendered in English prose with a note like "he said in Cantonese" the first time, then no further tagging needed), Mei switches fully into English for the nurse, and there's a moment where Mei starts translating word-for-word but then paraphrases to soften what the nurse actually said, so Grandpa doesn't fully understand the diagnosis is bad news yet. Show the gap between what's said and what's translated.

This second example does something a lot of code-switching scenes are secretly about: the space between languages as a place where information gets lost, softened, or withheld. That gap is dramatic gold, and it's much easier to engineer with full-line shifts than with mixed sentences.


Writing the untranslated moment: when to let readers sit in confusion

Here's the instinct you have to fight, both in yourself and in the AI's output: the urge to translate everything for the monolingual reader. Sometimes the most honest choice is to leave a line untranslated and let the reader feel exactly what an outsider character feels — locked out.

This isn't about being obscure for its own sake. It's a deliberate craft choice with a job to do. If your point-of-view character doesn't speak the second language, the untranslated line should read as genuinely opaque to them too — a wall of sound, an emotional temperature they can read even if the words are unavailable. If your POV character does speak both languages, the untranslated line can carry full meaning that only bilingual readers get in real time, while monolingual readers infer it from context, tone, and what happens next.

The trick with AI here is to tell it explicitly which reader experience you're going for, because left alone it will almost always over-explain, adding a clarifying phrase or internal thought that translates the line anyway ("she said something about being tired, I think"). That impulse to clarify is baked deep into how these models are trained to be "helpful," and it works against you constantly in fiction.

Write the moment where Dmitri's babushka says something sharp to him in Russian after he introduces his girlfriend for the first time. Do NOT translate or paraphrase what she says — the POV is the girlfriend's, and she doesn't speak Russian, so the sentence should land on the page in Russian with zero translation, and the narration should only convey the girlfriend's read of the tone (cold, clipped, a warning) and Dmitri's reaction (his shoulders dropping, a joke that doesn't quite land as he tries to cover). Let the reader stay as confused as she is. Do not add a footnote or glossary explanation.

Be ready to fight the model a little on this one — it will often try to sneak a translation back in through a "helpful" aside. If it does, just repeat the constraint more forcefully in a follow-up: "Remove the explanation of what she said. The reader should not know." Persistence here matters more than clever phrasing.

One caution: untranslated moments work best sparingly, at high-stakes beats, not scattered through every chapter — otherwise you're just frustrating your reader instead of putting them inside a specific character's isolation. Save it for the scenes where the not-knowing is the point.


Editing pass: catching stereotype, consistency errors, and overuse across a manuscript

Once you've drafted scenes with this method, you need a dedicated editing pass just for code-switching — it won't get caught by a generic line edit. Three specific failure modes show up constantly, and each needs its own check.

Stereotype creep. AI models trained on decades of lazy fiction have absorbed some ugly patterns: the "spicy" Latina who only speaks Spanish when angry or aroused, the wise elder who only speaks their native language in aphorisms, the villain whose foreign language cues menace. Read every switch and ask honestly whether it's revealing character or just performing a trope. If you're not fluent in the second language yourself, this is a place where a sensitivity reader or a bilingual beta reader earns their fee — build that into your beta reader workflow for AI-assisted manuscripts specifically, with a note asking them to flag anything that reads as costume rather than character.

Consistency errors. Does your character's switching logic hold across three hundred pages? If Renata only switches to Spanish under emotional intensity in chapter three, she shouldn't be casually sprinkling Spanish words for comic effect in chapter twenty unless something's changed and you've shown the change. This is exactly the kind of long-manuscript drift that a character consistency pass is built to catch — run it specifically against the switch-trigger rules you wrote earlier, not just against plot facts.

Overuse and reader fatigue. Code-switching that never rests becomes wallpaper — the reader stops noticing it, which defeats the purpose entirely. It works best as a deliberate instrument you reach for at specific emotional pressure points, not a constant hum under every scene. If a chapter feels thick with it, check your Dialogue vs Narration Ratio and see whether the switching is carrying real narrative weight or just padding word count.

Review this chapter for how I've handled code-switching for my character Amara (Nigerian-British, switches between English and Yoruba). Flag any instance where the switch feels like a stereotype rather than character-driven — specifically check for: switching only during anger or "sass," switching only for proverbs/wisdom, or switching that reads as decorative rather than tied to audience/emotion/topic per her established triggers [paste triggers]. Also flag any place where her switching pattern is inconsistent with how I wrote her in chapter 2 [paste chapter 2 excerpt for reference].

This kind of targeted audit prompt works far better than asking the model to "check for stereotypes" in general — you're giving it a specific, falsifiable rubric tied to the rules you already established, which is the same principle behind The Five-Pass Revision Order for AI-Assisted Novels: dedicate a whole pass to one category of problem instead of trying to catch everything at once.

If you're doing this work inside a platform built for long-form fiction rather than a general chat window, it's easier to keep the character's trigger rules persistently loaded so every scene generation respects them without you re-pasting context every time — worth comparing how different tools handle that kind of persistent character memory, including in write-ups like Entangled Text vs ChatGPT. And if code-switching is a major feature of your book rather than a occasional flourish, it's worth treating it as its own line item during your how to edit a book with AI pass rather than something you catch incidentally.


The one habit that fixes most of this: write down your character's switch triggers before you write a single line of their dialogue, and paste those triggers into every prompt where that character speaks. Not their vocabulary, not a list of foreign words to sprinkle in — the actual behavioral rule (anger reverts to Spanish, formality stays in English, this specific topic only exists in Korean). Everything else in this guide is just different applications of that one rule. Get the trigger right, and both you and the AI will know exactly when a character should switch, how far the switch should go, and when silence — or an untranslated sentence — says more than either language could alone.

Try it yourself

Write your own book with AI — free, no credit card required.

Free · No credit card