GitHub Action to translate MARKDOWN/READMEs to any language
Translate MARKDOWN files to various other languages, supports multiple files and subdirectories.
Add a workflow file to your project (e.g. .github/workflows/translate-readme.yml
):
name: Translate README
on:
push:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
# ISO Language Codes: https://cloud.google.com/translate/docs/languages
- name: Adding README - Chinese Simplified
uses: ikhsan3adi/markdown-translator@master
with:
LANG: zh-CN
FILES: |-
README.md
OTHER-README.md
sub/dir/README.md
very/deep/sub/directories/FOO.md
/very/deep/sub/directories/BAR.md
- name: Adding README translations
uses: ikhsan3adi/markdown-translator@master
with:
LANG: |- # multiple languages
zh-CN
zh-TW
ja
FILES: |-
README.md
OTHER-README.md
...
npm run build
before committing
You can configure the action further with the following options:
-
LANG
: Newline-separated list of the language you want to translate your readme to. The default is Simplified Chinese. The supported languages can be found below. (default:zh-CN
) (required:false
) -
FILES
: Newline-separated list of the markdown files you want to translate to. (default:[README.md]
) (required:false
)
Languages supported can be found here https://cloud.google.com/translate/docs/languages
Suggestions and contributions are always welcome!