A GitHub Crowdin Action lehetővé teszi a Crowdin projekt honosításának egyszerű integrálását az adattárában beállított munkafolyamatba a GitHub Actions segítségével. A GitHub Crowdin Action segítségével automatizálhatja a honosítási erőforrások szinkronizálását a Crowdin projektjével.
Mit csinál ez a művelet?
Állítson be egy munkafolyamatot itt: .github/workflows/crowdin.yml (vagy adjon hozzá egy feladatot a meglévő munkafolyamatokhoz).
Olvassa el a Munkafolyamat konfigurálása cikket az egyedi munkafolyamatok létrehozásának és beállításának részleteiről.
name: Crowdin Action
on:
push:
branches: [ master ]
jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: crowdin action
uses: crowdin/github-action@1.0.4
with:
upload_translations: true
download_translations: true
env:
GITHUB_TOKEN: $
CROWDIN_PROJECT_ID: $
CROWDIN_PERSONAL_TOKEN: $
Az alapértelmezett művelet az erőforrások feltöltése. A with
lehetőséggel azonban különböző műveleteket definiálhat. Ha nem akarja feltölteni az erőforrásait a Crowdinba, akkor állítsa a upload_sources
opciót false értékre.
Alapértelmezetten a források és a fordítások feltöltésre kerülnek a Crowdin projektje gyökérkönyvtárába. Ennek ellenére, ha ágakat használ, meghatározhatja a preferált forráságat.
Megadhatja azt is, hogy a GitHub melyik ágába szeretné letölteni a fordításokat (az alapértelmezett fordítási ág l10n_crowdin_action
).
Ha nem akarja letölteni a fordításokat a Crowdinból (download_translations: false
), localization_branch_name
és create_pull_request
opciók szintén nem szükségesek.
- name: crowdin action
with:
# upload options
upload_sources: true
upload_translations: true
# download options
download_translations: true
language: 'uk'
push_translations: true
# 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
# 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
# config options
# This is a numeric id, not to be confused with Crowdin API v1 "project identifier" string
# See "API v2" on https://crowdin.com/project/<your-project>/settings#api
project_id: $
# A personal access token, not to be confused with Crowdin API v1 "API key"
# See https://crowdin.com/settings#api-key to generate a token
token: $
source: '/path/to/your/file'
translation: 'file/export/pattern'
base_url: 'https://crowdin.com'
base_path: '/project-base-path'
A lehetőségek részletesebb leírása az alábbi linken találja: action.yml
.
Ha a munkafolyamat-fájl a config
beállítást tartalmazza, akkor a következőt kell hozzáadnia a Crowdin konfigurációs fájlhoz (pl. crowdin.yml
):
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
A munkafolyamat végrehajtásakor a token és a projektazonosító tényleges értékei a környezeti titkok felhasználásával beillesztésre kerülnek a konfigurációba.