From e63c303078a8b10cdad08a71434d932609c23d71 Mon Sep 17 00:00:00 2001 From: Shane Ringrose Date: Fri, 12 Jun 2026 09:09:39 +1200 Subject: [PATCH] Find translations when lang/ is beside the bin/ folder, not inside it (#86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QETApp::languagesPath() defaulted to applicationDirPath() + "/lang/". The Windows installer puts the executable in a bin/ subfolder while the lang/ folder sits next to it (../lang), so that default points at a non-existent bin/lang/ — qetTranslator.load() fails and setLanguage() silently falls back to the French source language. This is the root cause behind the long-standing 'language won't change / resets to French' reports, and why launching via 'Lancer QET.bat' (which passes --lang-dir=lang/) works around it. When the folder next to the binary doesn't exist, fall back to the sibling ../lang folder if present. Behaviour is unchanged for builds that already ship lang/ next to the binary, and for the QET_LANG_PATH and --lang-dir paths. Fixes #86. --- sources/qetapp.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index aaa462fc5..7c9f56b32 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1228,7 +1228,21 @@ QString QETApp::languagesPath() * en l'absence d'option de compilation, on utilise le dossier lang, * situe a cote du binaire executable */ - return(QCoreApplication::applicationDirPath() + "/lang/"); + { + const QString bin_dir = QCoreApplication::applicationDirPath(); + const QString next_to_bin = bin_dir + "/lang/"; + // Some packagings (notably the Windows installer) put the binary in a + // "bin" subfolder while "lang" sits beside it (../lang). Fall back to + // that layout when the folder next to the binary is absent, so the + // translations are found without a --lang-dir argument. See issue #86. + if (!QDir(next_to_bin).exists()) { + const QString sibling_of_bin = + QDir::cleanPath(bin_dir + "/../lang") + "/"; + if (QDir(sibling_of_bin).exists()) + return(sibling_of_bin); + } + return(next_to_bin); + } #else #ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH /* the compilation option represents