Auto update of english translation file based on sources (#2349)

* added auto-translation action

* made scripts executable

* reuse

* no-obsolete - reuse (#2392)

* other languages - reuse

* no-obsolete

see everything that is 'vanished', because it does not exist

* Update update_translation.sh

* +

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
This commit is contained in:
georgemoralis 2025-02-13 15:50:55 +02:00 committed by GitHub
parent c94cd531f0
commit 1e7f651b1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#!/bin/bash
set -e
sudo apt-get -y install qt6-l10n-tools python3
SCRIPT_PATH="src/qt_gui/translations/update_translation.sh"
chmod +x "$SCRIPT_PATH"
PATH=/usr/lib/qt6/bin:$PATH "$SCRIPT_PATH"

View file

@ -0,0 +1,31 @@
name: Update Translation
on:
schedule:
- cron: "0 0 * * *" # Every day at 12am UTC.
workflow_dispatch: # As well as manually.
jobs:
update:
if: github.repository == 'shadps4-emu/shadPS4'
name: "Update Translation"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set execution permissions for the script
run: chmod +x ./.github/workflows/scripts/update_translation.sh
- name: Update Base Translation
run: ./.github/workflows/scripts/update_translation.sh
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "Qt GUI: Update Translation"
commit-message: "[ci skip] Qt GUI: Update Translation."
committer: "shadPS4 Bot <Shadps4Boot@users.noreply.github.com>"
author: "shadPS4 Bot <Shadps4Boot@users.noreply.github.com>"
body: "Daily update of translation sources."
branch: update-translation
delete-branch: true

View file

@ -7,6 +7,8 @@ path = [
"CMakeSettings.json",
".github/FUNDING.yml",
".github/shadps4.png",
".github/workflows/scripts/update_translation.sh",
".github/workflows/update_translation.yml",
".gitmodules",
"dist/MacOSBundleInfo.plist.in",
"dist/net.shadps4.shadPS4.desktop",
@ -53,6 +55,7 @@ path = [
"src/images/website.png",
"src/shadps4.qrc",
"src/shadps4.rc",
"src/qt_gui/translations/update_translation.sh",
]
precedence = "aggregate"
SPDX-FileCopyrightText = "shadPS4 Emulator Project"

View file

@ -0,0 +1,13 @@
#!/bin/bash
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
OPTS="-tr-function-alias QT_TRANSLATE_NOOP+=TRANSLATE,QT_TRANSLATE_NOOP+=TRANSLATE_SV,QT_TRANSLATE_NOOP+=TRANSLATE_STR,QT_TRANSLATE_NOOP+=TRANSLATE_FS,QT_TRANSLATE_N_NOOP3+=TRANSLATE_FMT,QT_TRANSLATE_NOOP+=TRANSLATE_NOOP,translate+=TRANSLATE_PLURAL_STR,translate+=TRANSLATE_PLURAL_FS -no-obsolete"
SRCDIRS=$(realpath "$SCRIPTDIR/..")/\ $(realpath "$SCRIPTDIR/../..")/
OUTDIR=$(realpath "$SCRIPTDIR")
lupdate $SRCDIRS $OPTS -locations none -source-language en_US -ts "$OUTDIR/en_US.ts"
if ! head -n 2 "$OUTDIR/en_US.ts" | grep -q "SPDX-FileCopyrightText"; then
sed -i '2i\<!-- SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project\n SPDX-License-Identifier: GPL-2.0-or-later -->' "$OUTDIR/en_US.ts"
fi