What is ai-i18n?
ai-i18n is a GitHub Action that automates translation of application localization files using large language models. Teams add it to a GitHub workflow to translate new or changed strings into selected languages when source files are updated, then write and optionally commit the translated files to the repository. It supports XLIFF and JSON files and works with Anthropic, OpenAI, Ollama, or AWS Bedrock models, making it a fit for development teams maintaining multilingual software.
ai-i18n Features:
Workflow Translation: Run translations automatically on pushes, commits, or a schedule by adding the action to a GitHub Actions workflow.
File Format Support: Detect XLIFF 1.2, XLIFF 2.0, flat JSON, and nested JSON files automatically, or specify the format in the workflow.
Model Providers: Choose Anthropic, OpenAI, self-hosted Ollama, or AWS Bedrock, and configure a model supported by the selected provider.
Change Detection: Track content hashes for translation units and send only new or modified source strings to the model.
Plural Handling: Use CLDR plural rules for more than 20 languages to generate ICU MessageFormat plural categories for target locales.
Placeholder Preservation: Extract XLIFF inline elements before translation and reconstruct them in the output to retain tags and placeholders.
ai-i18n Benefits:
Faster Localization: Keeping translation work inside the development workflow can help localized versions keep pace with changes to the application.
Less Manual Handoff: Teams spend less time collecting files and sending them through a separate translation process.
Fewer Repeat Requests: Skipping unchanged strings avoids unnecessary model requests and helps limit translation spend on content already processed.
Cleaner File Updates: Preserved XLIFF markup and placeholders reduce the need to repair translated files before they can be used.
Safer Review: A dry run lets developers preview translation work without writing files or committing changes to the repository.
Use Cases:
New Interface Copy: Translate new or edited English strings into selected locales after changes land in a main-branch workflow.
XLIFF Projects: Generate translations for XLIFF files used by Angular, iOS, or Android applications while preserving inline elements.
JSON Locale Files: Update flat or nested JSON translation files when application copy changes, without resending strings that remain the same.
Translation Preview: Run a dry-run workflow to inspect proposed translations before deciding whether to write or commit the output.
Self-Hosted Models: Translate localization files through an Ollama model hosted by the team when a self-hosted provider is preferred.

