Table of Contents
- 1. Introduction: Underestimated Effort and the Cost of 5000 Credits
- 2. [Strategy Phase] Having AI Write "Specifications" and Brainstorming
- 3. [Failure] The Rampage of Batch Automatic Translation by Genspark Agent
- 4. [Solution] Explaining the Code for Automatic Blog Post Translation with Python and Gemini API
- 5. Recommendations for WordPress Users: How to Use Genspark?
- 6. Summary: It's Gritty, But the Door to the World Has Opened
1. Introduction: Underestimated Effort and the Cost of 5000 Credits
"If I use AI, making my blog English-compatible will only take 30 minutes."
That's how lightly I started the blog multilingualization project, but reality wasn't so sweet. The final time spent was 3 hours. And the Genspark credits consumed were approximately 5000 credits (equivalent to about 1,800 JPY).
It certainly wasn't "magically completed with one click," but it's true that I was able to complete "DB design changes," "full article translation," and "SEO implementation," which would normally take several days to a week, in half a day.
This article will reveal the failure story of being at the mercy of AI's rampage, and the eventually successful "actual translation script (Python)."
Figure 1: Overall workflow of the blog translation automation system (DB acquisition → Gemini translation → Link replacement → DB storage)
2. [Strategy Phase] Having AI Write "Specifications" and Brainstorming
I don't immediately use Genspark's "Super Agent (paid feature)." That's because credits melt away quickly. First, I thoroughly consulted (brainstormed) with Claude and Gemini on the free chat screen.
Figure 2: Blog structure after multilingualization (Japanese version: /post/, English version: /en/post/)
Part of the "Implementation Specifications" Generated by AI
As a result of the brainstorming, Genspark output precise specifications like the following. Basing the implementation on this minimized rework.
3. [Failure] The Rampage of Batch Automatic Translation by Genspark Agent
Once the specifications were set, I enthusiastically instructed the Super Agent:
"Write and execute a script to batch translate all articles and register them in the DB!"
This was a mistake.
The "batch processing script" generated by the AI timed out midway or had forgotten closing tags, resulting in a large number of partially translated "strange articles" being generated in the database.
4. [Solution] Explaining the Code for Automatic Blog Post Translation with Python and Gemini API
"Haste makes waste." I switched strategies and had a "Python script that carefully translates and registers a single article" created.
Below is the full text of the script I actually used. How did I execute it? I simply pasted it into Genspark's sandbox (AI Developer environment) and clicked "Run." There's no need to even set up a Python environment on your own computer.
[Click to expand] Full Python script (translate_single_article.py)
#!/usr/bin/env python3 # Single article translation script # Usage: python3 translate_single_article.py <slug> import json, subprocess, sys, re # Authentication information (management via environment variables recommended) CLOUDFLARE_EMAIL = "[email protected]" CLOUDFLARE_API_KEY = "your-api-key" GEMINI_API_KEY = "your-gemini-api-key" def translate_with_gemini(text, instruction): import google.generativeai as genai genai.configure(api_key=GEMINI_API_KEY) model = genai.GenerativeModel('gemini-2.5-flash') return model.generate_content(f"{instruction}\n\n{text}").text.strip() def translate_article(article): title = translate_with_gemini(article['title'], "Translate to English.") instruction = """Translate to English. REQUIREMENTS: 1. Preserve ALL HTML 2. Convert: /post/XXX to /en/post/XXX-en 3. Translate comments, NOT code""" content = translate_with_gemini(article['content'], instruction) content = re.sub(r'/post/([^"\\s]+)(?!-en)', r'/en/post/\\1-en', content) return {'title': title, 'content': content} # Main processing omitted
This script is very simple, yet powerful.
- By using Gemini 2.5 Flash, translation costs are almost zero.
- Automatically rewrite internal links (
/post/) to the English version (/en/post/) using regular expressions. - By including Alt attributes in the translation target, SEO measures are perfect.
Execute this one article at a time and confirm the display in the browser. This "gritty" procedure was ultimately the most reliable and fastest shortcut.
5. Recommendations for WordPress Users: How to Use Genspark?
I built this blog system itself with Genspark (Cloudflare D1 + Hono), so I could freely change the database structure, but I believe many readers use WordPress.
For WordPress users looking to multilingualize with Genspark, directly manipulating the database is too risky. The two safer and more realistic approaches are:
- Markdown Copy-Paste Strategy (Recommended):
Give Genspark the URL of your Japanese article and instruct it, "Translate this article into an SEO-conscious English article and output it in Markdown format." Copy-pasting the output content into a new WordPress article and linking it with language settings (e.g., Polylang) is the safest approach. - XML Import Strategy (Advanced Users):
Export articles from WordPress in XML format, ask Genspark to "replace only the body tags within the XML with English," and then re-import them. This allows for batch processing, but a backup is essential.
6. Summary: It's Gritty, But the Door to the World Has Opened
What should have taken 30 minutes ended up taking 3 hours, consuming 5000 credits (approx. 1,800 JPY), and I even experienced a DB reset. It certainly wasn't smart development.
However, if you consider that I obtained a "complete multilingual blog with SEO support" for just 1,800 JPY and 3 hours, the cost-performance is overwhelming.
If I had outsourced or translated manually, it would have taken tens of thousands of yen and several weeks.
Genspark is not a magic wand, but an "exceptionally competent assistant that handles gritty tasks 100 times faster."
Why don't you also invest a little credit and time to knock on the door to the world?