Home

Awesome

Translation action

Stand With Ukraine GitHub release (latest SemVer including pre-releases) unit-tests test-providers test-source security linting Maintainability Test Coverage Known Vulnerabilities

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

<!-- TOC --> <!-- TOC -->

Inputs

NameRequiredDescriptionDefaultPossible values
sourceYesCan be text or path to the file for translation<Path>,<String>
providerYesProvider identifierdeepl, google, libretranslate, linguatools, microsoft, mymemory, funtranslations
api_keyNoAPI key that should be used for chosen provider""<String>
api_additional_parameterNoAdditional parameter for the API. eg the region for Microsoft: canadacentral""<String>
langYesThe translation direction. Should be one of the option proposed by chosen provider<String>

Outputs

NameRequiredDescription
textYesTranslated text

Providers

DeepL

Example of translating "Love" word from English into Ukrainian:

jobs:
  deepl:
    name: DeepL
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: fabasoad/translation-action@main
        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

Example of translating "Victory" word from Malay into English:

jobs:
  google:
    name: Google
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: fabasoad/translation-action@main
        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

Example of translating "Victory" word from English into Ukrainian:

jobs:
  libretranslate:
    name: LibreTranslate
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: fabasoad/translation-action@main
        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 'Перемога'

Linguatools

"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

"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). More details here.

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, so lang parameter can be found here. Example:

- uses: fabasoad/translation-action@main
  with:
    provider: funtranslations
    lang: 'klingon'
    source: 'Who are you'