Skip to content
users

GitHub Action

Translation Action

v3.1.2 Latest version

Translation Action

users

Translation Action

This action translates any text to any language supported by chosen provider

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Translation Action

uses: fabasoad/[email protected]

Learn more about this action in fabasoad/translation-action

Choose a version

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

Inputs

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. eg 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

DeepL

  • Identifier is deepl.
  • Supported translation directions can be found here.
    • 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@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

  • Identifier is google.
  • Supported translation directions can be found here.
    • Be aware that source and target languages should be separated by - (hyphen) 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@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

  • Identifier is libretranslate.
  • Supported translation directions can be found here.
    • 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@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

  • 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"
  • How to get API key:

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

  • Identifier is mymemory.
  • Supported translation directions:

Language direction should be separated by | character. For example, en|it (from English to Italian). More details here.

  • How to get API key:

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

  • Identifier is funtranslations.
  • Supported translation directions:

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'