From 7211de297011130355a975d100a9653450c11882 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 18 Aug 2023 22:36:33 -0400 Subject: [PATCH] Add support for switching between languages in the Global client This includes Japanese, English, German and French - instead of being stuck to English only. I don't have access to a Chinese or Korean client, so these options are not available. --- launcher/accountconfig.kcfg | 19 +++++++++++++++++++ launcher/include/account.h | 5 +++++ launcher/include/profile.h | 5 ----- launcher/profileconfig.kcfg | 3 --- launcher/src/account.cpp | 14 ++++++++++++++ launcher/src/launchercore.cpp | 4 ++-- launcher/src/profile.cpp | 14 -------------- launcher/ui/Settings/AccountSettings.qml | 9 +++++++++ 8 files changed, 49 insertions(+), 24 deletions(-) diff --git a/launcher/accountconfig.kcfg b/launcher/accountconfig.kcfg index d17259e..700b7a7 100644 --- a/launcher/accountconfig.kcfg +++ b/launcher/accountconfig.kcfg @@ -14,6 +14,25 @@ SPDX-License-Identifier: CC0-1.0 + + + + + + + + + + + + + + + + + + English + diff --git a/launcher/include/account.h b/launcher/include/account.h index d474887..9d6438e 100644 --- a/launcher/include/account.h +++ b/launcher/include/account.h @@ -15,6 +15,7 @@ class Account : public QObject Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(int language READ language WRITE setLanguage NOTIFY languageChanged) Q_PROPERTY(QString lodestoneId READ lodestoneId WRITE setLodestoneId NOTIFY lodestoneIdChanged) Q_PROPERTY(QString avatarUrl READ avatarUrl NOTIFY avatarUrlChanged) Q_PROPERTY(bool isSapphire READ isSapphire WRITE setIsSapphire NOTIFY isSapphireChanged) @@ -36,6 +37,9 @@ public: QString name() const; void setName(const QString &name); + int language() const; + void setLanguage(int value); + QString lodestoneId() const; void setLodestoneId(const QString &id); @@ -71,6 +75,7 @@ public: Q_SIGNALS: void nameChanged(); + void languageChanged(); void lodestoneIdChanged(); void avatarUrlChanged(); void isSapphireChanged(); diff --git a/launcher/include/profile.h b/launcher/include/profile.h index 64a0af8..0625829 100644 --- a/launcher/include/profile.h +++ b/launcher/include/profile.h @@ -15,7 +15,6 @@ class Profile : public QObject Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(int language READ language WRITE setLanguage NOTIFY languageChanged) Q_PROPERTY(QString gamePath READ gamePath WRITE setGamePath NOTIFY gamePathChanged) Q_PROPERTY(QString winePath READ winePath WRITE setWinePath NOTIFY winePathChanged) Q_PROPERTY(QString winePrefixPath READ winePrefixPath WRITE setWinePrefixPath NOTIFY winePrefixPathChanged) @@ -59,9 +58,6 @@ public: QString name() const; void setName(const QString &name); - int language() const; - void setLanguage(int value); - QString gamePath() const; void setGamePath(const QString &path); @@ -155,7 +151,6 @@ public: Q_SIGNALS: void gameInstallChanged(); void nameChanged(); - void languageChanged(); void gamePathChanged(); void winePathChanged(); void winePrefixPathChanged(); diff --git a/launcher/profileconfig.kcfg b/launcher/profileconfig.kcfg index 9d08887..1c11659 100644 --- a/launcher/profileconfig.kcfg +++ b/launcher/profileconfig.kcfg @@ -16,9 +16,6 @@ SPDX-License-Identifier: CC0-1.0 - - 1 - ProfileManager::getDefaultGamePath(mParamuuid) diff --git a/launcher/src/account.cpp b/launcher/src/account.cpp index e060279..ee95b34 100644 --- a/launcher/src/account.cpp +++ b/launcher/src/account.cpp @@ -39,6 +39,20 @@ void Account::setName(const QString &name) } } +int Account::language() const +{ + return m_config.language(); +} + +void Account::setLanguage(const int value) +{ + if (m_config.language() != value) { + m_config.setLanguage(value); + m_config.save(); + Q_EMIT languageChanged(); + } +} + QString Account::lodestoneId() const { return m_config.lodestoneId(); diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index b2fa9fd..593f4ef 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -157,7 +157,7 @@ void LauncherCore::beginDalamudGame(const QString &gameExecutablePath, const Pro "--dalamud-configuration-path=" + Utility::toWindowsPath(dalamudConfigPath), "--dalamud-plugin-directory=" + Utility::toWindowsPath(dalamudPluginDir), "--dalamud-asset-directory=" + Utility::toWindowsPath(dalamudAssetDir), - "--dalamud-client-language=" + QString::number(profile.language()), + "--dalamud-client-language=" + QString::number(profile.account()->language()), "--logpath=" + Utility::toWindowsPath(logDir), "--", args}, @@ -178,7 +178,7 @@ QString LauncherCore::getGameArgs(const Profile &profile, const LoginAuth &auth) gameArgs.push_back({"DEV.MaxEntitledExpansionID", QString::number(auth.maxExpansion)}); gameArgs.push_back({"DEV.TestSID", auth.SID}); gameArgs.push_back({"SYS.Region", QString::number(auth.region)}); - gameArgs.push_back({"language", QString::number(profile.language())}); + gameArgs.push_back({"language", QString::number(profile.account()->language())}); gameArgs.push_back({"ver", profile.repositories.repositories[0].version}); gameArgs.push_back({"UserPath", Utility::toWindowsPath(profile.account()->getConfigDir().absolutePath())}); diff --git a/launcher/src/profile.cpp b/launcher/src/profile.cpp index 229f2ad..54d6940 100644 --- a/launcher/src/profile.cpp +++ b/launcher/src/profile.cpp @@ -140,20 +140,6 @@ void Profile::setName(const QString &name) } } -int Profile::language() const -{ - return m_config->language(); -} - -void Profile::setLanguage(const int value) -{ - if (m_config->language() != value) { - m_config->setLanguage(value); - m_config->save(); - Q_EMIT languageChanged(); - } -} - QString Profile::gamePath() const { return m_config->gamePath(); diff --git a/launcher/ui/Settings/AccountSettings.qml b/launcher/ui/Settings/AccountSettings.qml index 6b26406..f428c94 100644 --- a/launcher/ui/Settings/AccountSettings.qml +++ b/launcher/ui/Settings/AccountSettings.qml @@ -38,6 +38,15 @@ Kirigami.ScrollablePage { MobileForm.FormDelegateSeparator {} + MobileForm.FormComboBoxDelegate { + text: i18n("Language") + model: ["Japanese", "English", "German", "French"] + currentIndex: page.account.language + onCurrentIndexChanged: page.account.language = currentIndex + } + + MobileForm.FormDelegateSeparator {} + MobileForm.FormComboBoxDelegate { text: i18n("Account type") model: ["Square Enix", "Sapphire"]