🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add job to create translations PRs
Deluan9f684e5a69e3
diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.ymlnew file mode 100644index 000000000..76ea82640--- /dev/null+++ b/.github/workflows/update-translations.yml@@ -0,0 +1,26 @@+name: Update Translations+on:+ workflow_dispatch:+ schedule:+ - cron: '0 10 * * *'+jobs:+ update-dep:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v3+ - name: Get updated translations+ env:+ POEDITOR_PROJECTID: ${{ secrets.POEDITOR_PROJECTID }}+ POEDITOR_APIKEY: ${{ secrets.POEDITOR_APIKEY }}+ run: |+ ./update-translations.sh+ npm install+ - name: Create Pull Request+ uses: peter-evans/create-pull-request@v4+ with:+ token: ${{ secrets.PAT }}+ commit-message: Update translations+ title: Update translations+ body: |+ - Update translations with latest from POEditor+ branch: update-translationsdiff --git a/update-translations.sh b/update-translations.shnew file mode 100755index 000000000..35d599559--- /dev/null+++ b/update-translations.sh@@ -0,0 +1,25 @@+#!/bin/sh++set -e++download_lang() {+ url=$(curl -s -X POST https://poeditor.com/api/ \+ -d api_token="${POEDITOR_APIKEY}" \+ -d action="export" \+ -d id="${POEDITOR_PROJECTID}" \+ -d language="$1" \+ -d type="key_value_json" | jq -r .item)+ if [ -z "$url" ]; then+ echo "Failed to export $1"+ return 1+ fi+ curl -sSL "$url" > resources/i18n/"$1".json+}++for file in resources/i18n/*.json; do+ name=$(basename "$file")+ code=$(echo "$name" | cut -f1 -d.)+ lang=$(jq -r .languageName < "$file")+ echo "Downloading $lang ($code)"+ download_lang "$code"+done