Skip to content

Add format specifiers for day of year #174

Add format specifiers for day of year

Add format specifiers for day of year #174

Workflow file for this run

name: Sync translations with Crowdin (two-way)
on:
push:
branches: [ main ]
paths:
- '**/Resources*.resx'
- '.github/workflows/crowdin_sync.yml'
- '.github/.crowdin.yml'
issue_comment:
types: [created]
workflow_dispatch:
env:
# The git branch used for sync with crowdin and for the pull request
BRANCH: crowdin
# crowdin config
CONFIG: '.github/.crowdin.yml'
PROJECT: ${{ secrets.CROWDIN_PROJECT_ID }}
TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
concurrency:
group: ${{ github.workflow }}
jobs:
sync:
name: Sync translations with crowdin
runs-on: ubuntu-latest
if: |
github.event_name != 'issue_comment' || (
contains(github.event.issue.labels.*.name, 'translation') &&
contains(github.event.comment.body, '/sync')
)
steps:
- name: Install crowdin cli
run: |
wget https://artifacts.crowdin.com/repo/deb/crowdin3.deb -O crowdin.deb --no-verbose
sudo dpkg -i crowdin.deb
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup crowdin branch
run: |
ARGS="--base-path=. --config=$CONFIG --project-id=$PROJECT --token=$TOKEN --no-progress"
REF=$(basename $GITHUB_REF)
crowdin branch add $REF $ARGS
ARGS="--branch=$REF $ARGS"
echo "ARGS=$ARGS" >> $GITHUB_ENV
# Merge changes from git and crowdin and sync back to crowdin
##############################################################
- name: Prepare git branch for merge
run: |
git config user.name "Bot"
git config user.email "<>"
git checkout $BRANCH 2>/dev/null || git checkout -b $BRANCH $GITHUB_REF
- name: Download changes from crowdin
run: |
crowdin download sources $ARGS
crowdin download $ARGS
git status -s
git diff
git add .
git commit -m "Update from crowdin" || true
- name: Merge and resolve conflicts
run: |
git merge $GITHUB_REF -Xtheirs -v
git diff HEAD~1..
- name: Upload to crowdin
run: |
crowdin upload sources --delete-obsolete $ARGS
crowdin upload translations --import-eq-suggestions $ARGS
# Note: Without the "import-eq-suggestions" switch, new translations that literally match the source string
# would not be uploaded, so a PR would be opened during back-sync to remove these (redundant) translations.
# Create or update the pull request with data from crowdin
###########################################################
- name: Clean git branch
run: |
git checkout -B $BRANCH $GITHUB_REF
git checkout $(basename $GITHUB_REF)
- name: Download from crowdin
run: |
crowdin download sources $ARGS
crowdin download $ARGS
git status -s
git diff
- name: Collect statistics
run: |
echo 'INFO<<EOF' >> $GITHUB_ENV
crowdin status -v $ARGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
branch: ${{ env.BRANCH }}
commit-message: Translation updates from Crowdin
author: "Contributing Translators <[email protected]>"
title: Translation updates from Crowdin
labels: |
translation
body: |
Translation updates from [Crowdin project](https://crowdin.com/project/PasteIntoFile)
See [recent activity](https://crowdin.com/project/PasteIntoFile/activity-stream)
```
${{ env.INFO }}
```
----
- To re-sync and update this PR include /sync in a comment.
- To attribute translators, use squash merge with `Co-authored-by: eltos <[email protected]>`
- *Do not delete the branch after merging! It is required to correctly merge future changes from GitHub and Crowdin without overwriting either.*