• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A GitHub action to manage and synchronize localization resources with your Crowdin project

GitHub Crowdin Action Tweetย GitHub Repo stars

A GitHub action to manage and synchronize localization resources with your Crowdin project

What does this action do?

This action allows you to easily integrate and automate the localization of your Crowdin project into the GitHub Actions workflow.

  • Upload sources to Crowdin.
  • Upload translations to Crowdin.
  • Downloads translations from Crowdin.
  • Download sources from Crowdin.
  • Creates a PR with the translations.
  • Run any Crowdin CLI command.

Usage

Set up a workflow in .github/workflows/crowdin.yml (or add a job to your existing workflows).

Read the Configuring a workflow article for more details on creating and setting up GitHub workflows.

name: Crowdin Action

on:
  push:
    branches: [ main ]

jobs:
  synchronize-with-crowdin:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: crowdin action
        uses: crowdin/github-action@v1
        with:
          upload_sources: true
          upload_translations: true
          download_translations: true
          localization_branch_name: l10n_crowdin_translations
          create_pull_request: true
          pull_request_title: 'New Crowdin Translations'
          pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
          pull_request_base_branch_name: 'main'
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

secrets.GH_TOKEN - a GitHub Personal Access Token with the repo scope selected (the user should have write access to the repository).

Note In case you want to use an automatic GitHub authentication token, you need to assign the write permission to your job and allow GH Actions to create Pull Requests.

Supported options

The default action is to upload sources. However, you can set different actions using the "with" options. If you don't want to upload your sources to Crowdin, just set the upload_sources option to false.

By default, sources and translations are being uploaded to the root of your Crowdin project. Still, if you use branches, you can set the preferred source branch.

You can also specify what GitHub branch youโ€™d like to download your translations to (default translation branch is l10n_crowdin_action).

In case you donโ€™t want to download translations from Crowdin (download_translations: false), localization_branch_name and create_pull_request options aren't required either.

- name: crowdin action
  uses: crowdin/github-action@v1
  with:
    # Upload sources option
    upload_sources: true
    # This can be used to pass down any supported argument of the `upload sources` cli command, e.g.
    upload_sources_args: '--no-auto-update label=web'

    # Upload translations options
    upload_translations: true
    upload_language: 'uk'
    auto_approve_imported: true
    import_eq_suggestions: true
    # This can be used to pass down any supported argument of the `upload translations` cli command, e.g.
    upload_translations_args: '--auto-approve-imported --translate-hidden'

    # Download sources options
    download_sources: true
    push_sources: true
    # this can be used to pass down any supported argument of the `download sources` cli command, e.g.
    download_sources_args: '--reviewed'

    # Download translations options
    download_translations: true
    download_language: 'uk'
    skip_untranslated_strings: true
    skip_untranslated_files: true
    export_only_approved: true
    push_translations: true
    commit_message: 'New Crowdin translations by GitHub Action'
    # this can be used to pass down any supported argument of the `download translations` cli command, e.g.
    download_translations_args: '--all --skip-untranslated-strings'

    # This is the name of the git branch that Crowdin will create when opening a pull request.
    # This branch does NOT need to be manually created. It will be created automatically by the action.
    localization_branch_name: l10n_crowdin_action
    create_pull_request: true
    pull_request_title: 'New Crowdin translations'
    pull_request_body: 'New Crowdin pull request with translations'
    pull_request_labels: 'enhancement, good first issue'
    pull_request_assignees: 'crowdin-bot'
    pull_request_reviewers: 'crowdin-reviewer'
    # This is the name of the git branch to with pull request will be created.
    # If not specified default repository branch will be used.
    pull_request_base_branch_name: not_default_branch

    # Global options

    # This is the name of the top-level directory that Crowdin will use for files.
    # Note that this is not a "branch" in the git sense, but more like a top-level directory in your Crowdin project.
    # This branch does NOT need to be manually created. It will be created automatically by the action.
    crowdin_branch_name: l10n_branch
    identity: 'path/to/your/credentials/file'
    config: 'path/to/your/crowdin.yml'
    dryrun_action: true

    # GitHub (Enterprise) configuration
    github_base_url: github.com
    github_api_base_url: api.[github_base_url]
    github_user_name: Crowdin Bot
    github_user_email: [email protected]
    
    # For signed commits, add your ASCII-armored key and export "gpg --armor --export-secret-key GPG_KEY_ID"
    # Ensure that all emails are the same: for account profile that holds private key, the one specified during key generation, and for commit author (github_user_email parameter)
    gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
    gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}

    # Config options
    token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} # A Personal Access Token (see https://crowdin.com/settings#api-key)
    project_id: ${{ secrets.CROWDIN_PROJECT_ID }} # The numeric project ID. Visit the Tools > API section in your Crowdin project
    source: 'path/to/your/file'
    translation: 'file/export/pattern'
    base_url: 'https://api.crowdin.com'
    base_path: 'project-base-path' # Default: '.'

For more detailed descriptions of these options, see action.yml.

Note The base_url is required For Crowdin Enterprise and should be passed in the following way: base_url: 'https://{organization-name}.api.crowdin.com'

Crowdin CLI command

You can also run any other Crowdin CLI command by specifying the command and command_args (optional) options. For example:

- name: crowdin action
  uses: crowdin/github-action@v1
  with:
    command: 'pre-translate'
    command_args: '-l uk --method tm --branch main'

To see the full list of available commands, visit the official documentation.

Crowdin configuration file

If your workflow file specifies the config property, you'll need to add the following to your Crowdin configuration file (e.g. crowdin.yml):

project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN

When the workflow runs, the real values of your token and project ID will be injected into the config using the secrets in the environment.

Contributing

If you would like to contribute please read the Contributing guidelines.

Seeking Assistance

If you find any problems or would like to suggest a feature, please feel free to file an issue on GitHub at Issues Page.

License

The Crowdin GitHub Action is licensed under the MIT License.
See the LICENSE file distributed with this work for additional
information regarding copyright ownership.

Except as contained in the LICENSE file, the name(s) of the above copyright
holders shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written authorization.

More Repositories

1

crowdin-cli

A command-line client for the Crowdin API
Java
241
star
2

crowdin-api-client-js

JavaScript client library for Crowdin API
TypeScript
121
star
3

mobile-sdk-ios

Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately
Swift
116
star
4

mobile-sdk-android

Crowdin Android SDK delivers all new translations from Crowdin project to the application immediately
Kotlin
104
star
5

crowdin-cli-v1

A command-line client for the Crowdin API v1
Ruby
84
star
6

ota-client-js

JavaScript client library for Crowdin Over-The-Air Content Delivery
TypeScript
67
star
7

crowdin-api-client-java

Java client library for Crowdin API
Java
65
star
8

crowdin-api-client-ruby

Ruby client library for Crowdin API
Ruby
56
star
9

android-studio-plugin

Integrate your Android project with Crowdin
Java
56
star
10

crowdin-api-client-php

PHP client library for Crowdin API
PHP
55
star
11

crowdin-api-client-python

Python client library for Crowdin API
Python
54
star
12

crowdin-api-client-dotnet

.NET client library for Crowdin API
C#
53
star
13

vscode-crowdin

Crowdin Explorer for Visual Studio Code
TypeScript
51
star
14

sketch-crowdin

Connect your Sketch and Crowdin projects together
HTML
37
star
15

flutter-sdk

Crowdin Flutter SDK for instant translation delivery Over-The-Air directly to your application
Dart
25
star
16

crowdin-hybrid-sso-examples

Examples using Crowdin hybrid SSO
C#
15
star
17

zapier-integration

Connect Crowdin to hundreds of other apps with Zapier
JavaScript
13
star
18

react-native-sdk

Crowdin React Native SDK delivers all new translations from Crowdin project to the application immediately
Java
10
star
19

homebrew-crowdin

Homebrew Tap for Crowdin CLI
Ruby
9
star
20

editor-app

Crowdin for Mac, Windows, and Linux
JavaScript
8
star
21

react-crowdin-login

React component for a simple OAuth login with Crowdin
TypeScript
7
star
22

translate-readme

A GitHub Action to automate the translation of your README.md files via Crowdin โœจ
TypeScript
7
star
23

xamarin-sdk

Crowdin Xamarin SDK delivers all new translations from Crowdin project to the application immediately
C#
7
star
24

crowdin-apps-functions

Common functions used by Crowdin Apps
TypeScript
6
star
25

create-crowdin-app

Crowdin App skeleton
TypeScript
5
star
26

context-harvester

JavaScript
5
star
27

crowdin-script-editor

Crowdin Script Editor is an open source development and debugging tool for Crowdin custom QA checks
JavaScript
5
star
28

crowdin-api-client-go

Go client library for Crowdin API
Go
5
star
29

editor-anywhere

Plugin to any website that allows to search selected text in the Crowdin project and translate it in-place
JavaScript
3
star
30

.github

2
star
31

apps-quick-start

EJS
2
star