GEMINI LABJP
SPARK — Gemini 3.7 Flash became the engine behind Gemini Spark on August 13. Choosing round-trip speed over reasoning depth for agent work is a useful signal when picking your own modelAGENT — Spark carries out multi-step tasks autonomously once granted permission, handling things like booking appointments and filling forms rather than answering one command at a timeASSISTANT — Fourteen days until Gemini replaces Google Assistant on September 4. Once a device migrates there is no going back, though cars with Google Built-in keep Assistant for nowEDUCATION — Since August 10, Gemini in Classroom is available to K-12 and higher-education students of any age, provided their administrator has granted accessSCALE — The Gemini app now generates 150 million images a day. The interesting part is less the volume than how that sustained load is absorbed in practiceMODELS — The split has settled: Gemini 3.1 Pro for deep reasoning, the Flash line for production work where speed and cost matter. Running the same job through both makes the gap concreteSPARK — Gemini 3.7 Flash became the engine behind Gemini Spark on August 13. Choosing round-trip speed over reasoning depth for agent work is a useful signal when picking your own modelAGENT — Spark carries out multi-step tasks autonomously once granted permission, handling things like booking appointments and filling forms rather than answering one command at a timeASSISTANT — Fourteen days until Gemini replaces Google Assistant on September 4. Once a device migrates there is no going back, though cars with Google Built-in keep Assistant for nowEDUCATION — Since August 10, Gemini in Classroom is available to K-12 and higher-education students of any age, provided their administrator has granted accessSCALE — The Gemini app now generates 150 million images a day. The interesting part is less the volume than how that sustained load is absorbed in practiceMODELS — The split has settled: Gemini 3.1 Pro for deep reasoning, the Flash line for production work where speed and cost matter. Running the same job through both makes the gap concrete
Articles/Dev Tools
Dev Tools/2026-08-21Intermediate

Why My Length Limit Only Failed on the English Notifications, and the Width-Based Fit That Replaced It

I had Gemini write push notifications in Japanese and English, and only the English ones came out truncated on real devices. The culprit was measuring length in characters. Here are the measured widths and the post-generation fitting code that fixed it.

gemini105gemini-api281structured-output25i18n2push-notification2text-truncation

Premium Article

A reader in the US wrote in during the third week of the rollout: the notification text stops mid-sentence.

The app is a wallpaper app I run on my own. It sends a short announcement whenever new pieces are added, in Japanese and English. Gemini writes the copy, and my prompt said, plainly, "keep it under 40 characters." The Japanese notifications had been landing perfectly every time, so I assumed the same instruction was doing its job for English.

Every device I had checked on was set to a Japanese locale. That is why I never saw it.

The problem was not the quality of Gemini's output. It was my choice of unit. Below is what I measured on the way to understanding that, and the implementation I ended up with.

The short version: I stopped asking the model to respect a length

Here is the shape of the current pipeline.

  1. Gemini is never told to be brief. Instead it returns two fields — lead and detail — as structured output.
  2. All length adjustment happens afterward, in deterministic code.
  3. The unit is display width, not character count, and the way width is counted changes per language.

The whole change is a move from "make the model obey" to "have the model return something that degrades gracefully, and do the trimming myself." Here is why.

The same sentence is more than twice as long in English

I started by measuring strings close to what I was actually shipping. Display width here means: every character whose East Asian Width property is W, F, or A counts as 2, everything else counts as 1.

LanguageCharactersDisplay widthText
ja3467新しい浮世絵の壁紙を8枚追加しました。歌川広重の東海道シリーズです。
en81818 new ukiyo-e wallpapers are now available, including Hiroshige's Tokaido series.
ja2549今週の追加分は葛飾北斎の富嶽三十六景から6枚です。
en7474This week we added 6 pieces from Hokusai's Thirty-six Views of Mount Fuji.

The same message: 34 characters in Japanese, 81 in English. A factor of 2.4.

Now apply a flat "under 40 characters" to both. Japanese gets to use 80 units of display width. English gets 40. The same number was acting as a limit twice as tight in one language as the other. The English copy was not losing information because the model ignored me. It was losing information because my instruction was unreasonable in English.

There is a second reason not to push this onto the model at all. Gemini works in tokens, and "40 characters" is not a quantity it can count accurately while generating. Writing maxLength into your response_schema does not change this either — the API does not enforce string length, so an over-long value can come back and validate fine. The moment you depend on the model for a length guarantee, your pipeline has an unbounded failure mode.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Be able to tell, in your own code, whether a character-count limit or a token limit is the thing quietly failing on your multilingual strings
Understand why the same sentence measures 67 in Japanese and 81 in English, and budget display width per language instead of guessing
Catch the class of bug where one locale ships truncated text for weeks before anyone reports it, using a check that runs before delivery
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-08-10
Finding the questions your help docs never answer, by asking Gemini to write the quiz
When support keeps asking something your help page already covers, generate questions from that page and check whether the page alone can answer them. A two-pass audit pipeline with call design and cost math.
Dev Tools2026-08-15
Before Adding New iPhone Widths, I Had Gemini Write Out the Branches I Already Had
Adding three new screen widths to four apps turned into an extraction job, not a rewrite. Here is why I let Gemini pull the branch table out of the source and kept every pass/fail decision in deterministic code.
Dev Tools2026-06-17
Running Gemini Chat History on Redis — Field Notes on Not Losing Conversation State in Production
Keep a Gemini ChatSession in process memory and it evaporates on every redeploy or scale event. Here is how I back it with Redis in production, covering token budgets, concurrent sends, SDK coupling, and graceful degradation, with the code I actually run.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →