mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
71 lines
2.6 KiB
YAML
71 lines
2.6 KiB
YAML
# GitHub Action to update translations by downloading them from Crowdin,
|
|
# and open a Pull Request with the changes.
|
|
|
|
name: Update translations
|
|
on:
|
|
# Execute only on master
|
|
push:
|
|
branches:
|
|
- master
|
|
tags-ignore:
|
|
- "**" # Don't run on new tags
|
|
# Allows to run this workflow manually from the Actions tab.
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update-translations:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
cache: "npm"
|
|
cache-dependency-path: "newIDE/app/package-lock.json"
|
|
|
|
- name: Install gettext
|
|
run: sudo apt update && sudo apt install gettext -y
|
|
|
|
- name: Install newIDE dependencies
|
|
run: npm install
|
|
working-directory: newIDE/app
|
|
|
|
# We need to extract translations first to make sure all the source strings
|
|
# are included in the English catalogs. Otherwise, missing source strings
|
|
# with parameters (like "My name is {0}.") would be shown as-is when
|
|
# the app is built (but not in development - unclear why, LinguiJS issue?).
|
|
- name: Extract translations
|
|
run: npm run extract-all-translations
|
|
working-directory: newIDE/app
|
|
|
|
# (Build and) download the most recent translations (PO files) from Crowdin.
|
|
- name: Install Crowdin CLI
|
|
run: npm i -g @crowdin/cli
|
|
|
|
- name: Download new translations from Crowdin
|
|
run: crowdin download
|
|
env:
|
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
|
|
|
# Seems like the three letters code is not handled properly by LinguiJS?
|
|
# Do without this language while we find a solution.
|
|
- name: Remove catalogs not handled properly by LinguiJS compile command.
|
|
run: rm -rf newIDE/app/src/locales/pcm_NG/
|
|
|
|
- name: Compile translations into .js files that are read by LinguiJS
|
|
run: npm run compile-translations
|
|
working-directory: newIDE/app
|
|
|
|
- name: Create a Pull Request with the changes
|
|
uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
commit-message: Update translations [skip ci]
|
|
branch: chore/update-translations
|
|
delete-branch: true
|
|
title: "[Auto PR] Update translations"
|
|
body: |
|
|
This updates the translations by downloading them from Crowdin and compiling them for usage by the app.
|
|
|
|
Please double check the values in `newIDE/app/src/locales/LocalesMetadata.js` to ensure the changes are sensible.
|