mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
fix: translations are not being installed via make install
This commit is contained in:
@@ -32,6 +32,10 @@ Application::Application(int& argc, char** argv) :
|
||||
m_translatorApp = new QTranslator(this);
|
||||
ok = m_translatorApp->load("sqlb_" + name,
|
||||
QCoreApplication::applicationDirPath() + "/translations");
|
||||
// If failed then try to load .qm file from resources
|
||||
if (ok == false) {
|
||||
ok = m_translatorApp->load("sqlb_" + name, ":/translations");
|
||||
}
|
||||
|
||||
if (ok == true) {
|
||||
PreferencesDialog::setSettingsValue("General", "language", name);
|
||||
|
||||
@@ -394,6 +394,7 @@ void PreferencesDialog::fillLanguageBox()
|
||||
"en_US");
|
||||
}
|
||||
|
||||
// append availeble *.qm files from translation dir near executable
|
||||
foreach(const QFileInfo &file, translationsDir.entryInfoList())
|
||||
{
|
||||
QLocale locale(file.baseName().remove("sqlb_"));
|
||||
@@ -411,6 +412,28 @@ void PreferencesDialog::fillLanguageBox()
|
||||
ui->languageComboBox->addItem(QIcon(":/flags/" + locale.name()), language, locale.name());
|
||||
}
|
||||
|
||||
// append *.qm files from resources
|
||||
foreach (const QFileInfo &file, QDir(":/translations").entryInfoList())
|
||||
{
|
||||
QLocale locale(file.baseName().remove("sqlb_"));
|
||||
|
||||
// Skip invalid locales
|
||||
if(locale.name() == "C")
|
||||
continue;
|
||||
|
||||
// Translation for this locale already loaded in previous foreach
|
||||
if (ui->languageComboBox->findData(locale.name(), Qt::UserRole, Qt::MatchExactly) != -1)
|
||||
continue;
|
||||
|
||||
QString language = QLocale::languageToString(locale.language()) + " (" +
|
||||
QLocale::countryToString(locale.country()) + ")";
|
||||
|
||||
if (locale == systemLocale)
|
||||
language += " [System language]";
|
||||
|
||||
ui->languageComboBox->addItem(QIcon(":/flags/" + locale.name()), language, locale.name());
|
||||
}
|
||||
|
||||
ui->languageComboBox->model()->sort(0);
|
||||
|
||||
// Try to select the language for the stored locale
|
||||
|
||||
@@ -81,7 +81,8 @@ SOURCES += \
|
||||
FileDialog.cpp
|
||||
|
||||
RESOURCES += icons/icons.qrc \
|
||||
translations/flags/flags.qrc
|
||||
translations/flags/flags.qrc \
|
||||
translations/translations.qrc
|
||||
|
||||
FORMS += \
|
||||
MainWindow.ui \
|
||||
|
||||
8
src/translations/translations.qrc
Normal file
8
src/translations/translations.qrc
Normal file
@@ -0,0 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/translations">
|
||||
<file alias="sqlb_ru">sqlb_ru.qm</file>
|
||||
<file alias="sqlb_de">sqlb_de.qm</file>
|
||||
<file alias="sqlb_fr">sqlb_fr.qm</file>
|
||||
<file alias="sqlb_zh">sqlb_zh.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Reference in New Issue
Block a user