mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-13 16:23:14 +02:00
Find translations when lang/ is beside the bin/ folder, not inside it (#86)
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.
This commit is contained in:
+15
-1
@@ -1228,7 +1228,21 @@ QString QETApp::languagesPath()
|
|||||||
* en l'absence d'option de compilation, on utilise le dossier lang,
|
* en l'absence d'option de compilation, on utilise le dossier lang,
|
||||||
* situe a cote du binaire executable
|
* 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
|
#else
|
||||||
#ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH
|
#ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH
|
||||||
/* the compilation option represents
|
/* the compilation option represents
|
||||||
|
|||||||
Reference in New Issue
Block a user