@concircle/i18n-ai-translator
A CLI that translates a UI5 app's i18n.properties with OpenAI and writes the language files back, masking placeholders, applying a glossary and caching what has been translated.
A UI5 app ships its texts as i18n.properties, and every further language is another file somebody fills in by hand or sends out to be translated. This reads the base bundle and writes i18n_de.properties and its siblings back into the project, in missing mode for the keys with no text yet or overwrite for all of them. It masks the placeholders before sending the text to the model and validates that they are still present afterwards, and a glossary of shared and per-language terms sets a term's target word, Order to Auftrag in its own example. A local cache keyed on the provider, the model, the two languages and the source value holds what has been translated, so it is the text rather than the property key that decides whether a request repeats. It installs as a devDependency and runs as i18n-ai-translator from an npm script, or as a Translator class and a translateProject helper from Node; OpenAI is the only provider the configuration takes, and the key comes from OPENAI_API_KEY or the config file.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1@concircleHerbert KaintzHerbert KaintzMaintains this
In the atlas: maintains 1, contributes to 1@hkaintzmaintainers
What it declares
Every artifact
- Type
- CLI
- Origin
- Independently maintained
- Runtime
- Node.js
As a CLI
- Distributed through
- npm
Connections
Serving labels, messages and content per user locale
Download
Install
npm add @concircle/i18n-ai-translatorDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from concircle/i18n-ai-translator under MIT, read@concircle/i18n-ai-translator
|
Translates UI5 i18n.properties files with OpenAI, preserves placeholders, supports glossary terms, and writes language-specific .properties files.
|
Features
- Preserves placeholders like
{0},{name},%s,${variable}, and%1$s - Supports
missingandoverwritetranslation modes - Applies shared and language-specific glossary terms
- Writes UI5-style language files such as
i18n_de.properties - Supports optional Unicode escaping with per-language overrides
- Uses a local cache to avoid repeated translation requests
Installation
npm install --save-dev @concircle/i18n-ai-translator
CLI
Example package.json script:
{
"scripts": {
"i18n:translate": "i18n-ai-translator --input ./webapp/i18n/i18n.properties --languages de,fr --mode missing"
}
}
Show CLI help:
npx i18n-ai-translator --help
Enable Unicode escaping:
{
"scripts": {
"i18n:translate": "i18n-ai-translator --input ./webapp/i18n/i18n.properties --languages de,fr --mode missing --encode-unicode"
}
}
Configuration
Example i18n-ai.config.json:
{
"sourceLanguage": "en",
"targetLanguages": ["de", "uk"],
"translationMode": "missing",
"encodeUnicode": false,
"languageOptions": {
"de": { "encodeUnicode": true },
"uk": { "encodeUnicode": false }
},
"provider": "openai",
"providerOptions": {
"apiKey": "sk-...",
"model": "gpt-4.1-mini",
"temperature": 0,
"maxOutputTokens": 4000
},
"files": {
"input": "./webapp/i18n/i18n.properties"
},
"cache": {
"enabled": true,
"ttlMs": 604800000
},
"batchSize": 20,
"verbose": false
}
Supported top-level config fields:
interface TranslatorConfig {
sourceLanguage?: string;
targetLanguages: string[];
translationMode?: 'missing' | 'overwrite';
encodeUnicode?: boolean;
languageOptions?: Record<string, { encodeUnicode?: boolean }>;
provider?: 'openai';
providerOptions?: {
apiKey?: string;
model?: string;
baseURL?: string;
organization?: string;
temperature?: number;
maxOutputTokens?: number;
};
files?: {
input?: string;
outputDir?: string;
languageFilePattern?: string;
};
glossary?: GlossaryConfig | string;
cache?: {
enabled?: boolean;
ttlMs?: number;
dir?: string;
};
rules?: string[];
batchSize?: number;
verbose?: boolean;
}
Glossary
Example glossary file:
{
"shared": [
{
"source": "Order",
"target": "Auftrag",
"context": "SAP sales document"
}
],
"languages": {
"de": [
{
"source": "Plant",
"target": "Werk"
}
],
"uk": [
{
"source": "AI",
"target": "ШI"
}
]
}
}
Programmatic Usage
Translate a file directly:
import { Translator } from '@concircle/i18n-ai-translator';
const translator = new Translator({
sourceLanguage: 'en',
targetLanguages: ['de'],
translationMode: 'missing',
provider: 'openai',
providerOptions: {
apiKey: process.env.OPENAI_API_KEY
},
files: {
input: './webapp/i18n/i18n.properties'
}
});
const result = await translator.translateFile();
console.log(result);
Load config from file:
import { Translator } from '@concircle/i18n-ai-translator';
const translator = await Translator.fromConfig({
configPath: './i18n-ai.config.json'
});
const result = await translator.translateProject();
console.log(result);
Use the top-level helper:
import { translateProject } from '@concircle/i18n-ai-translator';
const result = await translateProject({
inputPath: './webapp/i18n/i18n.properties',
languages: ['de'],
dryRun: true
});
console.log(result);
Translation Modes
missing: only translates keys that are missing or empty in the target fileoverwrite: retranslates all keys from the source file
Placeholder Handling
The translator masks placeholders before sending text to the model and validates that they are still present afterwards.
Supported placeholder styles:
{0},{1}{name},{email}%s,%d%1$s,%2$d${variable}
Output Files
By default, UI5-style language files are generated next to the source file:
i18n.propertiesi18n_de.propertiesi18n_fr.properties
You can override the output directory or file naming pattern in files.outputDir and files.languageFilePattern.
Cache
Caching is enabled by default. Cache keys include:
- provider
- model
- source language
- target language
- source value
- glossary terms
- translation rules
Default cache location:
~/.i18n-ai-translator-cache/
Environment Variables
Supported environment variables:
export OPENAI_API_KEY=sk-...
export OPENAI_MODEL=gpt-4.1-mini
Examples
See examples/ for small runnable examples:
Development
npm run build
npm run lint
npm test
License
MIT © 2026 Herbert Kaintz - Concircle
Contributing
See CONTRIBUTING.md.
Security
See SECURITY.md.
History
Features 10, Docs 4
Notes
Added
- Initial beta release of @concircle/i18n-ai-translator
- OpenAI-powered translation for UI5 i18n.properties files
- Placeholder preservation ({0}, {name}, %s, ${var}, etc.)
- Glossary/Vocabulary support for domain-specific terms (e.g., SAP context)
- Optional caching system with TTL and glossary hash invalidation
- Batch-parallelized translation requests (up to 10 parallel)
- Extensible AI Provider architecture for future support (Claude, Gemini, etc.)
- Dual-output: CJS (.cjs) and ESM (.mjs) with TypeScript declarations
- Comprehensive test suite with placeholder preservation tests
- Full npm publishing support with quality gates
Documentation
- README.md with installation and quick start guide
- API documentation and configuration reference
- Contributing guidelines for community contributions
- Security policy for responsible disclosure
Others providing
Compare all 3 on the Localization page →- ui5-i18n-excel-converterui5-i18n-excel-converterA command-line tool that exports a UI5 app's i18n properties files to an Excel sheet of keys and languages for translators and imports the translated sheet back into the files.independent, ui5CLI converting UI5 i18n properties files to Excel and back
- @sap-ux/i18n@sap-ux/i18nA library that reads and writes the i18n bundles of a UI5 or CAP project from Node code, the i18n.properties file of a UI5 app and the i18n folder of a CAP project alike.sap official, ui5Reader and writer for i18n bundles of UI5 or CAP projects
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- First seen.
For your agent
- Ref
artifact:concircle-i18n-ai-translator- JSON
- /artifacts/concircle-i18n-ai-translator.json
- MCP
- Connecting an agent