
One Script, Two Languages: Building a Bilingual AI News Pipeline
I added an AI news section to my portfolio site and needed both English and Korean versions published simultaneously — English for the main site, Korean for DEV.to cross-posting. Building separate scripts per language was the obvious approach. It was also the wrong one. The Problem With Separate Scripts Two scripts meant duplicated API call logic, duplicated error handling, duplicated file creation. The only differences were the output collection name and the language in the prompt. So I asked the AI: "Build a single bash script that takes a language parameter and generates news in either English or Korean. Share the API call logic; only differentiate frontmatter and filenames." The result: generate-ai-news.sh with $1 as the language flag. ./scripts/generate-ai-news.sh en ./scripts/generate-ai-news.sh ko The branching logic inside the script was minimal: if [ " $LANGUAGE " = "ko" ] ; then COLLECTION = "ai-news-ko" else COLLECTION = "ai-news" fi API calls, error handling, and file gener
Continue reading on Dev.to
Opens in a new tab


