31 lines
920 B
Bash
31 lines
920 B
Bash
#!/usr/bin/env bash
|
|
# Scans all .ui files under src/ and runs pyside6-lupdate to generate/update .ts files next to them.
|
|
# Usage: Run from repository root: `bash dev/update_translations.sh`
|
|
set -euo pipefail
|
|
|
|
# Ensure we are in repo root (script's directory is dev/)
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
cd "$REPO_ROOT"
|
|
|
|
LUPDATE=".venv/bin/pyside6-lupdate"
|
|
if [[ ! -x "$LUPDATE" ]]; then
|
|
echo "Qt for Python lupdate not found at '$LUPDATE'. Ensure venv is created and PySide6 tools installed." >&2
|
|
exit 1
|
|
fi
|
|
|
|
shopt -s nullglob
|
|
mapfile -t UI_FILES < <(find src -type f -name '*.ui')
|
|
|
|
if [[ ${#UI_FILES[@]} -eq 0 ]]; then
|
|
echo "No .ui files found under src/. Nothing to update."
|
|
exit 0
|
|
fi
|
|
|
|
for ui in "${UI_FILES[@]}"; do
|
|
ts="${ui%.ui}.ts"
|
|
echo "Updating translations: $ui -> $ts"
|
|
"$LUPDATE" "$ui" -ts "$ts"
|
|
done
|
|
|
|
echo "Translation update completed." |