Show HN: Script to Generate i18n Localizations
claudio.uk·1d·
Discuss: Hacker News
📰SGML
Preview
Report Post

🙋‍♂️️About 📖 Writings

Posted on 5 Nov 2025 by Claudio Santini

With LLMs it has become much easier to generate localized versions of your application’s text.

On my NextJS projects, I typically use the next-intl module for localization.

Next-intl requires a folder with JSON files for each supported locale, e.g. en.json, es.json, fr.json etc. This script generates those files automatically starting from the en.json file, using the Gemini API to translate the text.

import {promises as fs} from 'fs';
import path from 'path';

const supportedLocales = ['en', 'es', 'fr', 'de', 'it', 'ja']; // Edit this list as needed

const googleGenAI = new GoogleGenAI({apiKey: process.env.GOOGLE_API_KEY});

fun...

Similar Posts

Loading similar posts...