Skip to content

Update translations #265

Update translations

Update translations #265

Workflow file for this run

# Modification along rffontenelle/python-docs-pt-br
name: Update translations
on:
workflow_dispatch:
schedule:
- cron: '40 23 * * *'
#push:
# paths:
# - '.github/workflows/update.yml'
# - 'scripts/update.sh'
# branches:
# - '3.11'
env:
CPYTHON_BRANCH: '3.11'
LANGUAGE: 'ja'
jobs:
update:
# Job to pull translation from Transifex platform, and commit & push changes
runs-on: ubuntu-latest
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v3
- name: Check out CPython
uses: actions/checkout@v3
with:
repository: python/cpython
persist-credentials: false
ref: ${{ env.CPYTHON_BRANCH }}
path: cpython
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install Transifex CLI
run: |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
working-directory: /usr/local/bin
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
pip3 install --upgrade pip
pip3 install -r requirements.txt -r cpython/Doc/requirements.txt
- name: Update translations
run: |
sh scripts/update.sh
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
LANGUAGE: ${{ env.LANGUAGE }}
- name: Wrap catalog message files
run: |
powrap --modified
- name: Commit and push changes
if: github.repository == 'python/python-docs-ja'
run: |
git config user.name github-actions
git config user.email [email protected]
git status
git add -A
git diff-index --quiet HEAD || ( git commit -m "Update translations from Transifex" && git push )
merge:
# Merge translations previously updated into older branches to make sure
# older versions of Python Docs gets translated as well.
# 'overwrite=true' means strings previously translated will get overwritten;
# other branches will preserve translated strings, only filling in new
# translations.
name: merge into ${{ matrix.branch }}
needs: [update]
strategy:
matrix:
branch: [ "3.10", "3.9", "3.8" ]
include:
- branch: "3.10"
overwrite: true
runs-on: ubuntu-latest
steps:
- name: Get current branch name
shell: bash
run:
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Check out source branch (${{ env.CURRENT_BRANCH }})
uses: actions/checkout@v3
with:
path: ${{ env.CURRENT_BRANCH }}
- name: Check out target branch (${{ matrix.branch }})
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
path: ${{ matrix.branch }}
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
pip3 install pomerge powrap
- name: Merge overwriting on stable release branch
if: ${{ matrix.overwrite == true }}
run: |
pomerge --from ${{ env.CURRENT_BRANCH }}/**/*.po --to ${{ matrix.branch }}/**/*.po
- name: Merge without overwriting on EOL or security-fix release branch
if: ${{ matrix.overwrite != true }}
run: |
pomerge --no-overwrite --from ${{ env.CURRENT_BRANCH }}/**/*.po --to ${{ matrix.branch }}/**/*.po
- name: Wrap catalog message files
run: |
powrap --modified -C ${{ matrix.branch }}
- name: Commit and push changes
if: github.repository == 'python/python-docs-ja'
run: |
cd ${{ matrix.branch }}
git config user.name github-actions
git config user.email [email protected]
git status
git add -A
git diff-index --quiet HEAD || ( git commit -m "Merge ${{ env.CURRENT_BRANCH }} into ${{ matrix.branch }}" && git push )