File qlcplus5-git-lrelease.patch of Package qlcplus5-git
diff --git a/translate.sh b/translate.sh
index 3ccbd5275..4ea398562 100755
--- a/translate.sh
+++ b/translate.sh
@@ -7,13 +7,80 @@ set -euo pipefail
# ./translate.sh create <ll_CC> [qmlui|ui]
which_qt() {
- local base="$1"
- command -v "$base" 2>/dev/null || command -v "${base}-qt6" 2>/dev/null || command -v "${base}-qt5" 2>/dev/null || true
+ local base="$1"
+ # Try environment variable first
+ if [ -n "${LRELEASE:-}" ] && [ "$base" = "lrelease" ]; then
+ echo "$LRELEASE"
+ return 0
+ fi
+ if [ -n "${LUPDATE:-}" ] && [ "$base" = "lupdate" ]; then
+ echo "$LUPDATE"
+ return 0
+ fi
+
+ # Try standard locations
+ local paths=(
+ "$(command -v "$base" 2>/dev/null || true)"
+ "$(command -v "${base}-qt6" 2>/dev/null || true)"
+ "$(command -v "${base}-qt5" 2>/dev/null || true)"
+ "$(command -v "${base}6" 2>/dev/null || true)"
+ )
+
+ # Common installation paths
+ local qt_paths=(
+ "/usr/lib/qt6/bin"
+ "/usr/lib64/qt6/bin"
+ "/usr/local/opt/qt@6/bin" # Homebrew on macOS
+ "/opt/homebrew/opt/qt@6/bin" # Homebrew on Apple Silicon
+ "/usr/lib/x86_64-linux-gnu/qt6/bin"
+ )
+
+ for path in "${qt_paths[@]}"; do
+ if [ -x "${path}/${base}" ]; then
+ echo "${path}/${base}"
+ return 0
+ fi
+ if [ -x "${path}/${base}-qt6" ]; then
+ echo "${path}/${base}-qt6"
+ return 0
+ fi
+ if [ -x "${path}/${base}6" ]; then
+ echo "${path}/${base}6"
+ return 0
+ fi
+ done
+
+ # Try any non-empty path from the standard locations
+ for path in "${paths[@]}"; do
+ if [ -n "$path" ]; then
+ echo "$path"
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+LRELEASE="$(which_qt lrelease)" || {
+ cat >&2 <<EOF
+Error: Could not find lrelease. Please install the Qt Linguist tools package.
+
+Common package names:
+- Debian/Ubuntu: qttools6-dev-tools or qttools5-dev-tools
+- Fedora: qt6-linguist or qt5-linguist
+- Arch Linux: qt6-tools or qt5-tools
+- macOS (Homebrew): qt or qt@5
+
+You can also set the LRELEASE environment variable to point to the lrelease executable.
+Example: LRELEASE=/path/to/lrelease ./translate.sh update
+EOF
+ exit 1
+}
+
+LUPDATE="$(which_qt lupdate)" || {
+ echo "Error: Could not find lupdate. Please install the Qt Linguist tools package." >&2
+ exit 1
}
-LRELEASE="$(which_qt lrelease)"
-LUPDATE="$(which_qt lupdate)"
-: "${LRELEASE:?lrelease not found}"
-: "${LUPDATE:?lupdate not found}"
ACTION="${1:-}"
UI_LANGS="de_DE es_ES fr_FR it_IT nl_NL cz_CZ pt_BR ca_ES ja_JP"