translation: New Crowdin updates (#1037) #317
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload translations strings to Crowdin | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
upload: | |
type: boolean | |
description: 'Push to crowdin?' | |
required: true | |
default: true | |
jobs: | |
crowdin: | |
if: "${{ !contains(github.event.head_commit.message, 'skip translate') }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set output | |
id: vars | |
run: | | |
TMP=$(mktemp -d) | |
echo "tmp_dir=${TMP}" >> $GITHUB_OUTPUT | |
- name: Setup PHP with composer v2 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
tools: composer:v2 | |
- name: Installing package dependencies | |
run: | | |
composer install --ignore-platform-reqs --no-interaction | |
sudo apt-get install -y gettext moreutils | |
- name: Build file list to proceed | |
run: | | |
find ./website/ -type f -name '*.php' -not -path './website/old/*' -not -path './website/vendor/*' -not -path './website/templates/*' | sort > ${{ steps.vars.outputs.tmp_dir }}/input-files-for-xgettext | |
cat ${{ steps.vars.outputs.tmp_dir }}/input-files-for-xgettext | |
- name: Generate po file | |
run: | | |
xgettext --from-code=UTF-8 -o ${{ steps.vars.outputs.tmp_dir }}/messages.pot --language=PHP -f ${{ steps.vars.outputs.tmp_dir }}/input-files-for-xgettext | |
- name: Extract strings from smarty templates | |
run: | | |
./vendor/smarty-gettext/smarty-gettext/tsmarty2c.php \ | |
-o ${{ steps.vars.outputs.tmp_dir }}/smarty.pot \ | |
./website/app-templates \ | |
./website/app-templates/smarty/js/*.js | |
- name: Concatenate po files | |
run: | | |
msgcat \ | |
-o website/app/languages/messages.po.txt \ | |
${{ steps.vars.outputs.tmp_dir }}/messages.pot \ | |
${{ steps.vars.outputs.tmp_dir }}/smarty.pot | |
- name: crowdin action | |
uses: crowdin/github-action@v2 | |
with: | |
config: crowdin.yml | |
project_id: 260106 | |
token: ${{ secrets.CROWDIN_API_KEY }} | |
upload_sources: true | |
upload_sources_args: --branch main | |
upload_translations: false | |
download_translations: false |