diff options
Diffstat (limited to 'raveos-calamares-module/welcome')
| -rw-r--r-- | raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp | 43 | ||||
| -rw-r--r-- | raveos-calamares-module/welcome/RaveWelcomeViewStep.h | 1 |
2 files changed, 40 insertions, 4 deletions
diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp index b2108c6..86ab549 100644 --- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp +++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp @@ -55,9 +55,44 @@ RaveWelcomeViewStep::~RaveWelcomeViewStep() QString RaveWelcomeViewStep::prettyName() const { + const QString locale = getLocale(); + if (locale.startsWith("hu")) + { + return QStringLiteral("Üdvözlés"); + } + if (locale.startsWith("de")) + { + return QStringLiteral("Willkommen"); + } return tr("Welcome"); } +QString RaveWelcomeViewStep::getLocale() const +{ + if (Calamares::JobQueue::instance()) + { + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + if (gs) + { + if (gs->contains("locale")) + { + const QString loc = gs->value("locale").toString(); + if (!loc.isEmpty()) + return loc; + } + + if (gs->contains("localeConf")) + { + const QString loc = gs->value("localeConf").toMap().value("LANG").toString(); + if (!loc.isEmpty()) + return loc; + } + } + } + + return QLocale::system().name(); +} + void RaveWelcomeViewStep::buildWidget() { auto* bg = new BgWidget(); @@ -141,10 +176,6 @@ void RaveWelcomeViewStep::onLanguageChanged(int index) m_currentLocaleIndex = index; QString localeId = m_localeIds[index]; - // Install new translator - this changes the entire Calamares UI language - Calamares::Locale::Translation::Id tid { localeId }; - Calamares::installTranslator(tid, brandingTranslationsPrefix()); - // Store locale in GlobalStorage for the installed system. // A localecfg a teljes localeConf-ot olvassa, ezért minden LC_* kulcsot // beírunk, ne csak a LANG-ot. @@ -174,6 +205,10 @@ void RaveWelcomeViewStep::onLanguageChanged(int index) } } + // Install new translator - this changes the entire Calamares UI language + Calamares::Locale::Translation::Id tid { localeId }; + Calamares::installTranslator(tid, brandingTranslationsPrefix()); + // Apply the matching live keyboard layout immediately, so the WiFi // password input follows the selected language (before the keyboard page). applyLiveKeyboardLayout(localeId); diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.h b/raveos-calamares-module/welcome/RaveWelcomeViewStep.h index af7bdff..87b42dd 100644 --- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.h +++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.h @@ -36,6 +36,7 @@ private slots: private: void buildWidget(); + QString getLocale() const; QString brandingTranslationsPrefix() const; void applyLiveKeyboardLayout(const QString& localeId); |