Skip to content

Add transly to automate i18n files localization #3322

@vitonsky

Description

@vitonsky

Prerequisites

  • I have searched for duplicate or closed feature requests
  • I am mindful of the project scope

Proposal

Hey, what about to add transly to automate the translation process of localization files via LLMs?

Example transly.config.ts:

import 'dotenv/config';
import { defineConfig } from 'transly';

export default defineConfig({
  sourceLang: 'en',
  targetLangs: ['es', 'zh', 'ru', 'pt-BR'],
  localesDir: './src/locales',

  llm: {
    model: 'google/gemma-4-26b-a4b-it',
    apiKey: process.env.OPENAI_API_KEY,
    baseUrl: 'https://openrouter.ai/api/v1',
  },
});

Then user will run npx transly translate to translate only changed keys from source locale into all others.

Transly support a fallback to a free Google Translation service if llm config is not provided, so even those developers who do not have API tokens can automate the translation.

I’ve already translated a few apps this way, and the translation quality has been quite good. You can check the translation examples. And our production config as example with providing the app context, to ensure consistent terms use.

Transly implements incremental translation for only those keys that have been changed, so no hassle with translate whole namespace file in all languages just because you've updated some text in one button.

I can send PR if you're opened for that feature.

Currently transly supports only JSON localization files, but I have just created a task to introduce codec option to handle any other formats like YAML that is used on that project. If you are opened to automate translation, I can release that feature and send PR to integrate transly here.

Motivation and context

Localization is important for SEO and can significantly expand the audience a product can reach.

Localization automation makes the process almost trivial — developers only need to run npx transly translate and publish a new version of the site. After that, the site becomes available in all target languages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions