Skip to content

Commit ce8f49d

Browse files
committed
localization: Use path relative to the application executable
This allows the languages to be loaded when the user is running the app from another directory (e.g. when the app is run from an exported path).
1 parent ae03113 commit ce8f49d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Application.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Application::Application(int& argc, char** argv) :
3030

3131
// First of all try to load the application translation file.
3232
m_translatorApp = new QTranslator(this);
33-
ok = m_translatorApp->load("sqlb_" + name, "translations");
33+
ok = m_translatorApp->load("sqlb_" + name,
34+
QCoreApplication::applicationDirPath() + "/translations");
35+
3436
if (ok == true) {
3537
PreferencesDialog::setSettingsValue("General", "language", name);
3638
installTranslator(m_translatorApp);

src/PreferencesDialog.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ void PreferencesDialog::removeExtension()
265265

266266
void PreferencesDialog::fillLanguageBox()
267267
{
268-
QDir translationsDir("translations", "sqlb_*.qm");
268+
// Use the path relative to the main executable
269+
QDir translationsDir(QCoreApplication::applicationDirPath() + "/translations",
270+
"sqlb_*.qm");
269271

270272
// Add default language
271273
ui->languageComboBox->addItem("English (United States)", "en_US");

0 commit comments

Comments
 (0)