mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
fix(translations): redownload index if it is missing after file reloading
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
5f7aa2fbdb
commit
49aef77f3f
2 changed files with 16 additions and 12 deletions
|
|
@ -937,15 +937,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||
qInfo() << "<> Network done.";
|
||||
}
|
||||
|
||||
// load translations
|
||||
{
|
||||
m_translations.reset(new TranslationsModel("translations"));
|
||||
auto bcp47Name = m_settings->get("Language").toString();
|
||||
m_translations->selectLanguage(bcp47Name);
|
||||
qInfo() << "Your language is" << bcp47Name;
|
||||
qInfo() << "<> Translations loaded.";
|
||||
}
|
||||
|
||||
// Instance icons
|
||||
{
|
||||
auto setting = APPLICATION->settings()->getSetting("IconsDir");
|
||||
|
|
@ -1024,8 +1015,16 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||
qInfo() << "<> Cache initialized.";
|
||||
}
|
||||
|
||||
// now we have network, download translation updates
|
||||
m_translations->downloadIndex();
|
||||
// load translations
|
||||
{
|
||||
m_translations.reset(new TranslationsModel("translations"));
|
||||
auto bcp47Name = m_settings->get("Language").toString();
|
||||
m_translations->selectLanguage(bcp47Name);
|
||||
qInfo() << "Your language is" << bcp47Name;
|
||||
qInfo() << "<> Translations loaded.";
|
||||
|
||||
m_translations->downloadIndex();
|
||||
}
|
||||
|
||||
// FIXME: what to do with these?
|
||||
m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
|
||||
|
|
|
|||
|
|
@ -267,7 +267,12 @@ void TranslationsModel::reloadLocalFiles()
|
|||
{
|
||||
QMap<QString, Language> languages = { { g_defaultLangCode, Language(g_defaultLangCode) } };
|
||||
|
||||
readIndex(d->m_dir.absoluteFilePath("index_v2.json"), languages);
|
||||
const auto indexPath = d->m_dir.absoluteFilePath("index_v2.json");
|
||||
if (!QFileInfo::exists(indexPath)) {
|
||||
downloadIndex();
|
||||
return;
|
||||
}
|
||||
readIndex(indexPath, languages);
|
||||
auto entries = d->m_dir.entryInfoList({ "mmc_*.qm", "*.po" }, QDir::Files | QDir::NoDotAndDotDot);
|
||||
for (auto& entry : entries) {
|
||||
auto completeSuffix = entry.completeSuffix();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue