{"id":24641060,"url":"https://github.com/aexol-studio/dev-translate","last_synced_at":"2025-05-12T14:58:57.020Z","repository":{"id":269449794,"uuid":"902846662","full_name":"aexol-studio/dev-translate","owner":"aexol-studio","description":"Translate i18 JSON files automatically with best translating engine in the world without losing format","archived":false,"fork":false,"pushed_at":"2025-03-04T11:44:19.000Z","size":5580,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T23:35:55.098Z","etag":null,"topics":["astro","cli","i18","i18next","localization","nextjs","nuxtjs","react","svelte","vite","vitejs"],"latest_commit_sha":null,"homepage":"https://devtranslate.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aexol-studio.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-13T11:45:20.000Z","updated_at":"2025-03-04T11:40:58.000Z","dependencies_parsed_at":"2024-12-23T17:20:41.408Z","dependency_job_id":"3a9def61-41a3-4013-bedd-b5493a06778e","html_url":"https://github.com/aexol-studio/dev-translate","commit_stats":null,"previous_names":["aexol-studio/dev-translate"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aexol-studio%2Fdev-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aexol-studio%2Fdev-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aexol-studio%2Fdev-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aexol-studio%2Fdev-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aexol-studio","download_url":"https://codeload.github.com/aexol-studio/dev-translate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253761013,"owners_count":21960052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","cli","i18","i18next","localization","nextjs","nuxtjs","react","svelte","vite","vitejs"],"created_at":"2025-01-25T12:12:06.540Z","updated_at":"2025-05-12T14:58:56.949Z","avatar_url":"https://github.com/aexol-studio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dev Translate\n\nTranslate your JSON i18 folders with:\n- CLI command\n- best file translator in the world\n- AI context\n\nFeatures:\n\n- generate folder i18 structure\n- configure input language and desired output languages\n- provide input language and input language folder then devtranslate detects other locale folders and translates files in watch mode. You only need to manage files in one language of your choice\n- supports 30+ languages\n\nThis plugin is particularly useful for developers working with projects that have multiple language support and require seamless translation updates during development.\n## Installation\n\n```sh\n$ npm i @aexol/dev-translate\n```\n\n## How it works\n\n![Dev translate](./devtranslateapp.gif)\n\n```sh\n$ dev-translate translate\n```\n\nInteractive command will ask you for the paths and will create a `.dev-translate.json` config file for further use.\n\n```\n{\n    \"apiKey\": \"YOUR_API_KEY\",\n    \"localeDir\": \"locales\",\n    \"inputLanguageFolderName\": \"en\",\n    \"inputLanguage\": \"ENUS\",\n    \"context\": \"User Interface of a web app used to SEO\"\n}\n```\n\nConfig will also include all the dev-translate available languages. \n\nThen dev-translate CLI will translate all the json files from input Language and create files with same names in language folder.\n\nFor example if you have a folder `./locales/` with `en` , `pl`. `de`, `fr`, `in` and you choose `en` as an input language. Dev translate will automatically translate from `en` to all other langauges keeping the json file structure.\n\n## Predict translation cost\n\nAs translations consume tokens from API you can easily predict translation cost of your locale folder by running:\n\n```sh\ndev-translate predict\n```\n\n## Cache\n\nDev-translate backend includes cache inside it so we don't need to implement local cache here\n\n### Clear Account cache\n\nIf you want to clear your cache not to reuse cached translations anymore:\n\n```sh\ndev-translate clear\n```\n\n## Plugins\n\n### Options\nThose options are parameters of options param of each plugin.\n\n#### `apiKey`\n- **Type:** `string`\n- **Description:** The API key required for accessing the translation service. Obtain this key from your translation provider.\n\n#### `folderName`\n- **Type:** `string`\n- **Description:** The name of the folder within your `localeDir` that contains the i18n JSON files of your **input language**. The plugin will monitor this folder for changes.\n\n#### `lang`\n- **Type:** `Languages`\n- **Description:** Language code of the **input language**\n\n#### `localeDir`\n- **Type:** `string`\n- **Description:** The directory path relative to the project root where the locale files are stored.\n- \n#### `context`\n- **Type:** `string`\n- **Description:** AI Context for better translations. Tell the translator engine what those translations are about\n\n### NextJSa\n`@aexol/nextjs-dev-translate-plugin ` is a Vite plugin designed to automatically translate i18n JSON files while Vite is in watch mode. \n\n#### Installation\n\nTo install the plugin, use either npm or yarn:\n\n```bash\nnpm install @aexol/nextjs-dev-translate-plugin --save-dev\n```\n#### Importing the Plugin\n\nIn your Next.js configuration file (`next.config.js` or `next.config.mjs`), import and configure the plugin with the necessary options.\n\n```typescript\n\nconst { withDevTranslate } = await import('@aexol/nextjs-dev-translate-plugin');\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n    //...your config\n};\n\n/** @type {import('@aexol/nextjs-dev-translate-plugin').withDevTranslate} */\nexport default withDevTranslate(nextConfig, {\n    apiKey: 'your-api-key',\n    folderName: 'pl',\n    lang: 'PL',\n    localeDir: './src/app/i18n/locales',\n});\n```\n\n#### Example\n\nIf your project has the following structure:\n\n```\nmy-project/\n│\n├── src/\n│   └── locales/\n│       ├── pl\n│       │   ├── home.json\n│       │   └── auth.json\n│       ├── en\n│       │   ├── home.json\n│       │   └── auth.json\n│       └── de\n│           ├── home.json\n│           └── auth.json\n│\n└── nextjs.config.mjs\n```\n\n\nYou would configure the plugin as follows:\n\n```typescript\nconst { withDevTranslate } = await import('@aexol/nextjs-dev-translate-plugin');\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n    //...your config\n};\n\n/** @type {import('@aexol/nextjs-dev-translate-plugin').withDevTranslate} */\nexport default withDevTranslate(nextConfig, {\n    apiKey: 'your-api-key',\n    folderName: 'pl',\n    lang: 'PL',\n    localeDir: './src/app/i18n/locales',\n});\n\n```\n\nThis will enable the plugin to automatically watch and translate the JSON files from the `src/locales/pl` folder to `en` and `de` folders\n\n### Vite\n\n`@aexol/vite-plugin-dev-translate` is a Vite plugin designed to automatically translate i18n JSON files while Vite is in watch mode. \n\n#### Installation\n\nTo install the plugin, you can use npm or yarn:\n\n```bash\nnpm install @aexol/vite-plugin-dev-translate --save-dev\n```\n\n#### Importing the Plugin\n\nIn your `vite.config.js` or `vite.config.ts` file, import the plugin and configure it with the required options.\n\n```typescript\nimport { defineConfig } from 'vite';\nimport devTranslatePlugin from '@aexol/vite-plugin-dev-translate';\n\nexport default defineConfig({\n  plugins: [\n    devTranslatePlugin({\n      apiKey: 'your-api-key-here',\n      folderName: 'locales',\n      lang: 'en-US',\n      localeDir: 'src/locales'\n    })\n  ]\n});\n```\n\n#### Example\n\nIf your project has the following structure:\n\n```\nmy-project/\n│\n├── src/\n│   └── locales/\n│       ├── en\n│       │   ├── home.json\n│       │   └── auth.json\n│       ├── fr\n│       │   ├── home.json\n│       │   └── auth.json\n│       └── es\n│           ├── home.json\n│           └── auth.json\n│\n└── vite.config.ts\n```\n\nYou would configure the plugin as follows:\n\n```typescript\nimport { defineConfig } from 'vite';\nimport devTranslatePlugin from '@aexol/vite-plugin-dev-translate';\n\nexport default defineConfig({\n  plugins: [\n    devTranslatePlugin({\n      apiKey: 'your-api-key-here',\n      folderName: 'en',\n      lang: 'ENUS',\n      localeDir: 'src/locales'\n    })\n  ]\n});\n```\n\nThis will enable the plugin to automatically watch and translate the JSON files from the `src/locales/en` folder to `fr` and `es` folders\n\n## License\n\nThis project is licensed under the MIT License.\n\n\n## Test ground and development\n\nRun \n```\n$ npm run build\n$ cd packages/testground\n$ npm run start\n```\n\n\n## Roadmap\n\n\n\n- [ ] support XML files in CLI\n- [x] support JSON files in CLI\n- [x] support predictions\n- [x] support cache clear\n- [x] support NextJS\n- [x] support Vite\n- [x] support Astro provided via Vite\n- [x] support SvelteKit provided via Vite\n- [x] support Nuxt provided via Vite\n- [ ] support Angular\n- [x] support Remix provided via Vite","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faexol-studio%2Fdev-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faexol-studio%2Fdev-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faexol-studio%2Fdev-translate/lists"}