Gemini redrew the entire Kalamos YAML document information preview screenshot into English: card title, tags, body text, blockquote, and even the word count in the bottom right are all translated

Background

My workflow for writing technical articles is: first write in Chinese on my own blog, push a draft to Dev.to, and finally use a small tool I wrote, devto-blog-translation-tool, to translate all Chinese drafts into English and publish them in one go.

I've been using this tool for a while. Text translation has always been solid, but one flaw has become increasingly obvious:

The article is translated into English, but the screenshots inside are still full of Chinese.

For example, in my recent Kalamos Devlog series, every post has several app screenshots and architecture diagrams. English readers ended up seeing English text paired with Chinese images, which felt very jarring.

So this time I added a new feature: when translating an article, if Chinese text is detected in an image, ask Gemini to redraw an English version and swap out the image in the post.

As usual, the entire feature was built inside Herdr: Claude Code handled writing specs and reviews, while Antigravity (agy, powered by Gemini 4 Neon) in the right pane wrote the code, going through six rounds of "implementation → review → real-world testing". However, the star of this post isn't the workflow—it's just how good Gemini itself is at "translating images" and "translating long-form articles".

1. What the Entire Pipeline Looks Like

Before translating the body text of each Chinese article, it first runs through an image processing pass:

Extract Image URLs ─▶ Download ─▶ Detect Chinese + Estimate Char Count ─▶ Redraw in English ─▶ Compare & Verify (Original vs. New) ─▶ Upload to GCS & Replace URLs 
Step Model Used What It Does
Detect Chinese Gemini 4 Neon (gemini-4-neon) Inspects the image to determine if it contains Chinese and estimates roughly how many Chinese characters there are
Redraw in English Nano Banana Pro (gemini-3-pro-image) Takes the original image and outputs a new image with the same layout, color scheme, and icons, replacing only the text with English (2K, automatically choosing the aspect ratio closest to the original)
Compare & Verify Gemini 4 Neon Looks at both the original and new images together to confirm there is no leftover Chinese and no missing panels or information
Translate Content & Title Gemini 4 Neon Translates the entire markdown; if the title exceeds Dev.to's 128-character limit, rewrites and shortens it automatically

The new image is uploaded to a publicly readable Google Cloud Storage bucket, and the image URL in the article is replaced with the GCS URL. If any image fails at any step, it simply logs a warning and keeps the original image without failing the entire article.

The prompt for redrawing the image is actually quite simple:

Recreate this image exactly, keeping layout, style, colors, icons and non-text content identical, but translate all Chinese text into natural English. Keep code, URLs, and proper nouns as-is. 

What truly surprised me is how much Nano Banana Pro can accomplish with just this one prompt.

2. Where Gemini Shines at Translating Images

1. Near 1-to-1 Redraws of UI Screenshots

Here is the update dialog that pops up when Kalamos detects a new version. The original is in Chinese:

Original: Kalamos Chinese update dialog

After handing it to Nano Banana Pro:

English update dialog redrawn by Gemini

A few details that I think it nailed:

  • Layout, rounded corners, color scheme, and button colors are completely preserved—at first glance, you'd think it's a screenshot of a native English UI from the app.
  • Buttons use idiomatic software UI phrasing: "稍後 / 立即更新" is translated as "Later / Update Now", rather than a stiff literal translation.
  • The version number 0.8.0 → 0.8.1 and arrow symbol are kept as-is, and English headings like Patch Changes are left untouched.
  • The original image was only 948×612, while the output is 2K resolution, making it even sharper than the original.

2. It Understands What the Screen Is Saying, Not Just Swapping Words

The YAML document information preview at the beginning of this article is the one I find most impressive:

Original: Kalamos Chinese YAML document information preview

Not only did it translate "文件資訊" into "Document Information" and tags like 技術寫作 and 靜態部落格 into Technical Writing and Static Blog, it also translated the article body and blockquote into fluent English—while keeping the body text in a serif font and preserving the green border on the left side of the blockquote.

What really made me smile was the bottom right corner: the original "183 字" was changed to "183 Words". This means the model understood it's an editor's word count, and that an English UI should display "words" rather than literally translating "字" into "characters".

At the same time, YAML keys like title, date, author, and draft, as well as values like 2026-11-24, Evan Lin, Maintainer, and false, were all left completely untouched. It clearly distinguishes between UI text that should be translated and data that must not be modified.

Of course, it's not flawless: if you look closely at the last line of the blockquote, there's a repeated word "exactly exactly". Small typos like this even slipped past the subsequent verification step—it's the kind of minor imperfection you currently have to accept with image translation.

3. Gemini 4 Neon as the Judge: Catching Images That Are "Wrong Without Any Chinese"

Image generation is inherently stochastic. For the Quick Open panel (Cmd+P) screenshot, the first redraw attempt came out like this:

First redraw failure: the entire Cmd+P search panel disappeared, leaving only the background article

All the text was indeed translated into English, but the entire search panel vanished, leaving only the article content behind it. That panel was the whole point of the screenshot—swapping it in like this would actually mislead readers.

At the time, my verification only checked "is there any Chinese left?", so it slipped through. Later, I changed it to pass both the original and new images to Gemini 4 Neon for comparison:

The first image is the original image, and the second image is its English-translated version. ... Does the second image preserve all major UI elements, panels, dialogs, chart/diagram sections, and information from the first image? ... 

Testing with the exact same failed image, Neon pinpointed the issue immediately:

The central quick-open search dialog modal from the original image is completely missing.

Meanwhile, for the other two good images, it reported preserves_content: true. When I ran it for real later, the regenerated version kept the panel completely intact and passed verification:

Regenerated and verified version: search panel, fuzzy match highlights, and Recent badge are all present

Notice how the green fuzzy-match highlights (k, a, l, m) in the filename list are still in the right positions, the "最近" badge became "Recent", and the bottom shortcut hints "↑↓ 移動 Enter 開啟 ⌘Enter 新分頁 Esc 關閉" were translated into "↑↓ Move Enter Open ⌘Enter New Tab Esc Close".

Using one Gemini to draw the image and another Gemini to inspect and gatekeep it—this combination was the most worthwhile design decision of the whole project.

4. Estimating Character Count: Knowing Which Images Not to Touch

Not every image is suitable for redrawing. The first version had no guardrails, and when I tried it on a Windows architecture diagram (2880×2570, packed densely with Chinese text), the result was rough:

First-version failure case: after redrawing a dense architecture diagram, most Chinese turned into garbled fake characters, and the English had typos too

  • Only the title and left-column labels were translated into English; the two large middle sections remained in Chinese, with glyphs distorted into nonexistent garbled characters
  • The English had typos like Portripring Ads and macos-teest
  • The output was only 1094×976 (at the time I hadn't specified a resolution, so it defaulted to 1K)

That image had actually already been swapped in on Dev.to—I reverted it to the original as soon as I noticed.

The solution was to have the detection step also estimate how many Chinese characters are in the image, and if it exceeds a threshold, skip it and keep the original. Gemini 4 Neon's estimates turned out to be very useful:

Image Est. Chinese Chars Result
Auto-update trust chain flowchart ~710 Skipped, kept original
Windows cross-platform architecture diagram ~533 Skipped, kept original
External PR review flowchart ~390 Skipped, kept original
Side-by-side Chinese/English UI comparison ~221 Skipped, kept original
YAML document information preview ~127 ✅ Redrawn
Cmd+P Quick Open ~115 ✅ Redrawn
Update dialog ~92 ✅ Redrawn

I currently set the threshold at 150: regular UI screenshots are handed to Gemini to redraw, while information-dense architecture diagrams are safely kept as-is.

3. Where Gemini Shines at Translating Long Articles

The images are eye-catching, but translating the article body itself is what I actually rely on day to day. After switching to Gemini 4 Neon, several aspects of its performance really put my mind at ease.

1. Translating 18,000 Characters in a Single Pass

Feature Evolution After Open-Sourcing is the longest post in the series:

Metric Value
Original length 17,810 characters
Chinese character count 6,418
Output tokens 9,255
Thinking tokens 3,052
Time taken ~115 seconds

The entire markdown file was sent in one shot and translated in a single pass, preserving all heading levels, tables, code blocks, and links. The resulting English body was about 37,000 characters, using only about one-fifth of the output limit (65,536).

2. Knowing When to Preserve Intentionally Quoted Chinese

After translating, I checked the output and found 21 Chinese characters remaining in the body. At first I thought it missed them, but on closer inspection, every single one was supposed to stay:

  • When the article mentioned an error message expected on screen in an E2E test, it preserved the original Chinese string and added an English explanation:

  • When the article introduced the changeset guidelines, explaining that the format must be written in Traditional Chinese as **標題** :說明, it also preserved this example:

If those two places had been translated into English, the article would actually become factually wrong. It understands that this Chinese text is the "subject being discussed" rather than "content to be translated"—that's far smarter than naive machine translation.

In addition, image alt text was translated along with the rest, for example:

Real dialog appearing during a real-machine update check for Kalamos v0.8.0 on macOS: showing current version 0.8.0 → new version 0.8.1 and CHANGELOG content

For readers using screen readers, this is also a very important detail.

3. Automatically Rewriting Titles That Are Too Long

Dev.to has a 128-character limit for titles, and my Chinese titles often blow past that once translated into English. My old approach was hard truncation, which resulted in titles like this:

…Using Multiple Agents to Review and Take Over Exte

Now I ask Gemini 4 Neon to rewrite it within 128 characters. Testing the same 150-character title twice:

120 characters: [Kalamos Devlog] After Open-Sourcing: Feature Evolution (v0.2 to v0.7) and Multi-Agent Review & Takeover of External PRs

126 characters: [Kalamos Devlog] After Open-Sourcing: v0.2–v0.7 Feature Evolution & Using Multiple Agents to Review and Take Over External PRs

The leading [Kalamos Devlog] tag is preserved, none of the key information is lost, and it reads far more naturally than a hard cut. Only if both rewrite attempts fail does it fall back to "truncating at a word boundary".

4. A Few Pitfalls Hit During Implementation

For anyone else looking to build something similar with Gemini:

  1. The new Go SDK defaults to API v1, but these models are only available in v1beta. On the very first real run, google.golang.org/genai returned models/gemini-3-flash-preview is not found for API version v1. All my unit tests used mocks, so they completely missed this. The fix is to pass HTTPOptions: genai.HTTPOptions{APIVersion: "v1beta"} when creating the client.
  2. Thinking tokens in reasoning models count toward MaxOutputTokens. Title shortening was originally set to 4096, and Gemini 4 Neon burned through the entire budget just thinking, failing both times. Bumping it to 16384 made it rock solid—and you're only billed for actual usage anyway.
  3. Long articles occasionally "overthink". The first time I translated that long post, it hit the limit and failed, yet re-testing via the API used only one-fifth of the limit—seeming like an occasional runaway thinking loop. After adding an "auto-retry once on hitting the limit", re-running that post succeeded on the first try.
  4. Always run post-generation verification, and compare against the original image. Checking only "is there any Chinese?" isn't enough—image models can accidentally omit critical elements. Having another model inspect it side by side with the original is the only way to catch these mistakes.

5. How to Use It

The tool is open-source: kkdai/devto-blog-translation-tool. Image translation is an optional feature—if GCS_BUCKET isn't set, it behaves exactly as before.

# 1. Allow the program to upload images using your GCP credentials gcloud auth application-default login # 2. Create a publicly readable bucket gcloud storage buckets create gs://YOUR_BUCKET --uniform-bucket-level-access gcloud storage buckets add-iam-policy-binding gs://YOUR_BUCKET \ --member=allUsers --role=roles/storage.objectViewer # 3. Set environment variables (can also be placed in .env) export GCS_BUCKET=YOUR_BUCKET export IMAGE_MAX_CHINESE_CHARS=150 # Default is 60; increase if you have many UI screenshots # 4. Run go build -o translator ./cmd/translator && ./translator 

When it runs, you'll see the processing result for each image:

 🖼️ Image 1/4: .../kalamos-dev-collab-pr-workflow.png ... ⏭️ too much text (~390 Chinese chars), keeping original 🖼️ Image 2/4: .../kalamos-dev-collab-quick-open.png ... ✅ replaced 🖼️ Image 3/4: .../kalamos-dev-collab-front-matter.png ... ✅ replaced 🖼️ Image 4/4: .../kalamos-dev-collab-bilingual.png ... ⏭️ too much text (~228 Chinese chars), keeping original Translating content... (removing frontmatter) ✅ Updating article ID 5118206 and publishing... ✅ Published! 

⚠️ Reminder: This tool translates all drafts with Chinese titles and publishes them directly, and uploaded images are stored in a public bucket. For your first run, it's recommended to keep only a single test article.

Conclusion

My biggest takeaway this time is: Gemini's image models are already good enough for "localization". As long as it's a standard UI screenshot, the English version redrawn by Nano Banana Pro is high enough quality to go straight into a published article.

However, it's not a silver bullet. Architecture diagrams packed with dense text still break, and generation results vary from run to run. So what actually made this feature production-ready wasn't how powerful a single model is, but these three lines of defense:

  1. Estimate character count first, avoiding images it can't draw well;
  2. Compare and verify against the original image, letting Gemini 4 Neon act as the judge;
  3. Keep the original on any failure—better to leave an image unchanged than swap in a broken one.

Now, in the English edition of my Kalamos Devlog series, the UI screenshots—the update dialog, Quick Open, and YAML preview—have all been replaced with English versions, while the dense architecture diagrams remain untouched. From now on, when writing new posts, I just need to focus on writing in Chinese and leave the rest to Gemini.