autotranslatedoc v1.0.11
Automatic Documentation Translation with LLMs
zh-Hans | es | fr | ru | de | ja | ko | pt | it | ar | tr | pl | nl | vi | th | fa | ro | sv | hu | cs | el | da | fi | he | no | hi | zh_tw | in | sl | se | sk | uk | bg | hr | lt | lv | et | cat
This tool leverages the capabilities of OPEN AI GPT 3.5 / 4 to automatically translate documentation files (i.e., .md/.mdx files) within a GitHub repository.
Disclaimer: This tool is currently under development
Installation
The tool can be installed via NPM:
npm install -g autotranslatedocEnsure to set up the environment variables: GITHUB_PERSONAL_ACCESS_TOKEN and OPENAI_API_KEY. Alternatively, these tokens can be passed as parameters. Refer to the GitHub documentation for obtaining a GITHUB_PERSONAL_ACCESS_TOKEN.
Usage
Help Page
Access the help page with the following command:
autotranslatedoc -hTranslating Documentation
Autotranslatedoc take 3 arguments and many options
autotranslatedoc <command> <repo_org> <repo_name> (options)commandcan be either:translate(to translate),update(to update a translation),build(to build a translation)repo_orgis the org of the target repository on GitHubrepo_nameis the name of the target repository on GitHub
The main options available are:
--language <lang_1>(, <lang_2>)*(or-l) to select the language you want to translate to.--docPath </url/path>(or-d) to limit translation to files in a specific path.--savePath <./localPath>(or-s) to select the directory where the save file will be saved (default to./save).--outputPath <./localPath>(or-o) when usingbuild, to specified where the translated doc files will be output (default to./build)
To translate the documentation of a target repository into French and Spanish, use:
autotranslatedoc translate run-llama llama_index -l fr,esThis command creates a llama_index.json file in the run-lama directory of the specified output directory (default is ./save).
ls ./save
run-llama
llama_index.json The save file contains all translations and can be used to generate the documentation in a target format (currently only .md).
To build the translated documentation, use:
autotranslatedoc build run-llama llama_index -l fr,esThis command generates fr and es directories in the buildPath (default is ./build) containing the translated documentation files.
To update the translated documentation based on changes in the original files, use:
autotranslatedoc update run-llama llama_index -l fr,esTo review the documentation via a server (experimental feature), use:
autotranslatedoc serve run-llama llama_indexTranslating Docusaurus Documentation
For translating documentation hosted in Docusaurus, use:
autotranslatedoc translate run-llama LlamaIndexTS --docPath /apps/docs/docs -l fr,es -m docusaurus
autotranslatedoc build run-llama LlamaIndexTS --docPath /apps/docs/docs -l fr,es -m docusaurusTranslating README.md Only
To translate only the README file, use the readme mode:
autotranslatedoc translate run-llama LlamaIndexTS -l fr,es -m readme
autotranslatedoc build run-llama LlamaIndexTS -l fr,es -m readmeTranslating to All Supported Languages
To translate to all supported languages, use the -l all option:
autotranslatedoc translate run-llama LlamaIndexTS -l all -m readme
autotranslatedoc build run-llama LlamaIndexTS -l all -m readmeKnown Issues
Currently, translation with -all is only supported from English to all other languages.