Translation action

This action translates any text to any language supported by chosen provider.
There is a list of providers that can be used for text translation. Please find
more details for each provider below.
Contents
| Name |
Required |
Description |
Default |
Possible values |
| source |
Yes |
Can be text or path to the file for translation |
|
<Path>,<String> |
| provider |
Yes |
Provider identifier |
|
deepl, google, libretranslate, linguatools, microsoft, mymemory, funtranslations |
| api_key |
No |
API key that should be used for chosen provider |
"" |
<String> |
| api_additional_parameter |
No |
Additional parameter for the API, e.g. the region for Microsoft: canadacentral |
"" |
<String> |
| lang |
Yes |
The translation direction. Should be one of the option proposed by chosen provider |
|
<String> |
Outputs
| Name |
Required |
Description |
| text |
Yes |
Translated text |
Providers
AWS
- Identifier is
aws.
- Supported translation directions
- How to get API key: Please follow the steps described in this
article.
- How to use:
- You will need to define Access Key ID and Secret Access Key in
api_key parameter
separated by | (pipe) character.
- You will also need to provide the region of the key using the
api_additional_parameter.
with:
api_key: "${{ secrets.ACCESS_KEY_ID }}|${{ secrets.SECRET_ACCESS_KEY }}"
api_additional_parameter: "ap-northeast-1" # AWS region
DeepL
- Identifier is
deepl.
- See supported translation directions
for more details.
- Be aware that source and target languages should be separated by
- (hyphen)
character while using them in lang input. For example, en-uk should be used
in case you want to translate text from English into Ukrainian. See example
below for more details.
- How to get API key:
- Sign up to DeepL (free plan is fine).
- Go to
Account -> Account -> Authentication Key for DeepL API section
Example of translating “Love” word from English into Ukrainian:
jobs:
deepl:
name: DeepL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: fabasoad/translation-action@v4
id: deepl-step
with:
provider: deepl
lang: en-uk
source: Love
api_key: ${{ secrets.DEEPL_API_KEY }}
- name: Print the result
run: echo "Translation is '${{ steps.deepl-step.outputs.text }}'"
shell: sh
Output is the following:
> echo "Translation is 'Любов'"
Translation is 'Любов'
Google
- Identifier is
google.
- See supported translation directions
for more details.
- Be aware that source and target languages should be separated by
| (pipe)
character while using them in lang input. For example, ms|en should be used
in case you want to translate text from Malay into English. See example below
for more details.
Example of translating “Victory” word from Malay into English:
jobs:
google:
name: Google
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: fabasoad/translation-action@v4
id: google-step
with:
provider: google
lang: ms|en
source: Kemenangan
- name: Print the result
run: echo "Translation is '${{ steps.google-step.outputs.text }}'"
shell: sh
Output is the following:
> echo "Translation is 'Victory'"
Translation is 'Victory'
LibreTranslate
- Identifier is
libretranslate.
- See supported translation directions
for more details.
- Be aware that source and target languages should be separated by
- (hyphen)
character while using them in lang input. For example, en-es should be used
in case you want to translate text from English into Spanish. See example
below for more details.
- How to get API key:
Example of translating “Victory” word from English into Ukrainian:
jobs:
libretranslate:
name: LibreTranslate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: fabasoad/translation-action@v4
id: libretranslate-step
with:
provider: libretranslate
lang: en-uk
source: Victory
api_key: ${{ secrets.LIBRETRANSLATE_API_KEY }}
- name: Print the result
run: echo "Translation is '${{ steps.libretranslate-step.outputs.text }}'"
shell: sh
Output is the following:
> echo "Translation is 'Перемога'"
Translation is 'Перемога'
- Identifier is
linguatools. API Key is not needed for this provider.
- Supported translation directions:
"de-en","de-es","de-nl","de-pl","de-it","de-cs","en-de","es-de","nl-de","pl-de","it-de","cs-de"
Microsoft
- Identifier is
microsoft.
- Supported translation directions:
"af","ar","bg","bn","bs","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hi","hr","ht","hu","id","is","it","ja","ko","lt","lv","ms","mt","mww","nb","nl","pl","pt","ro","ru","sk","sl","sr-Latn","sv","sw","ta","th","tlh-Latn","tr","uk","ur","vi","zh-Hans"
Please follow the steps described in this
article.
You will also need to provide the region of the key using the
api_additional_parameter, e.g.:
with:
api_additional_parameter: "canadacentral"
MyMemory
Language direction should be separated by | character. For example, en|it
(from English to Italian).
API Key is optional. Visit Usage Limit Page
to see the usage limit for free accounts. In case you want to use your API KEY,
you should go to Registration Page and
register a new account. Then go to API Key Generator Page
and generate a new key.
FunTranslations
from direction is English only at this moment.
Example:
- uses: fabasoad/translation-action@v4
with:
provider: "funtranslations"
lang: "klingon"
source: "Who are you"
api_key: "${{ secrets.FUNTRANSLATIONS_API_KEY }}"
Contributions

评论