mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-25 13:57:45 +00:00
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.
This commit is contained in:
parent
4bedd006ec
commit
7211de2970
8 changed files with 49 additions and 24 deletions
|
@ -14,6 +14,25 @@ SPDX-License-Identifier: CC0-1.0
|
|||
<group name="account-$(uuid)">
|
||||
<entry key="Name" type="string">
|
||||
</entry>
|
||||
<entry key="Language" type="Enum">
|
||||
<choices>
|
||||
<choice name="Japanese">
|
||||
</choice>
|
||||
<choice name="English">
|
||||
</choice>
|
||||
<choice name="German">
|
||||
</choice>
|
||||
<choice name="French">
|
||||
</choice>
|
||||
<choice name="ChineseSimplified">
|
||||
</choice>
|
||||
<choice name="ChineseTraditional">
|
||||
</choice>
|
||||
<choice name="Korean">
|
||||
</choice>
|
||||
</choices>
|
||||
<default>English</default>
|
||||
</entry>
|
||||
<entry key="LodestoneId" type="string">
|
||||
</entry>
|
||||
<entry key="IsSapphire" type="bool">
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -16,9 +16,6 @@ SPDX-License-Identifier: CC0-1.0
|
|||
</entry>
|
||||
<entry key="Account" type="string">
|
||||
</entry>
|
||||
<entry key="Language" type="int">
|
||||
<default>1</default>
|
||||
</entry>
|
||||
<entry key="GamePath" type="Path">
|
||||
<default code="true">ProfileManager::getDefaultGamePath(mParamuuid)</default>
|
||||
</entry>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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())});
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Reference in a new issue