Translate #71
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: Translate | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: '0 6 15 * *' | |
push: | |
branches: [master] | |
paths: | |
- '**/*.resx' | |
- '!**/*.*.resx' # Don't trigger again for updated translations | |
jobs: | |
translate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- name: Filter non-localizable WinForms resources | |
shell: pwsh | |
run: | | |
foreach ($file in (Get-ChildItem src -Recurse -Filter "*Form.resx") + (Get-ChildItem src -Recurse -Filter "*Dialog.resx") + (Get-ChildItem src -Recurse -Filter "*Wizard.resx")) { | |
[xml]$localized = Get-Content $file.FullName.Replace(".resx", ".de.resx") | |
[xml]$source = Get-Content $file.FullName | |
$source.root.assembly + $source.root.metadata + ($source.root.data | where { !$localized.root.data.name.Contains($_.name) }) | foreach { $source.root.RemoveChild($_) } | Out-Null | |
$source.Save($file.FullName) | |
git update-index --assume-unchanged $file.FullName | |
} | |
- name: Transifex Push | |
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} push --source | |
- name: Transifex Pull (fully translated) | |
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} pull --translations --mode translator --all --minimum-perc 100 | |
- name: Transifex Pull (partially translated) # Only languages that can be completed with Machine Translation | |
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} pull --translations --mode translator --languages cs,el,es,fr,id,it,ja,ko,nl,pl,pt_PT,ro,ru,zh | |
- name: DeepL Cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/*.a.resx' | |
key: deepl | |
- name: DeepL Translate | |
uses: Yeah69/MrMeeseeks.ResXTranslationCombinator@main | |
env: | |
GITHUB_TOKEN: ${{github.token}} | |
with: | |
auth: ${{secrets.DEEPL_API_KEY}} | |
source-lang: en | |
localization-filter: cs;el;es;fr;id;it;ja;ko;nl;pl;pt-PT;ro;ru;zh | |
glossary-name: Zero Install | |
excludes-regex: .*ImageResources.* | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
branch: translate | |
commit-message: Update translations | |
title: Update translations | |
body: Translations downloaded from Transifex and generated with DeepL |