android: settings: Add system language setting.
This commit is contained in:
parent
4f4bcb8b22
commit
cd16b01f88
@ -139,18 +139,21 @@ public final class SettingsFragmentPresenter {
|
|||||||
mView.getActivity().setTitle(R.string.preferences_system);
|
mView.getActivity().setTitle(R.string.preferences_system);
|
||||||
|
|
||||||
Setting region = null;
|
Setting region = null;
|
||||||
|
Setting language = null;
|
||||||
Setting systemClock = null;
|
Setting systemClock = null;
|
||||||
Setting dateTime = null;
|
Setting dateTime = null;
|
||||||
|
|
||||||
if (!mSettings.get(SettingsFile.SETTINGS_DOLPHIN).isEmpty()) {
|
if (!mSettings.get(SettingsFile.SETTINGS_DOLPHIN).isEmpty()) {
|
||||||
region = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_REGION_VALUE);
|
region = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_REGION_VALUE);
|
||||||
|
language = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_LANGUAGE);
|
||||||
systemClock = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_INIT_CLOCK);
|
systemClock = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_INIT_CLOCK);
|
||||||
dateTime = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_INIT_TIME);
|
dateTime = mSettings.get(SettingsFile.SETTINGS_DOLPHIN).get(SettingsFile.SECTION_SYSTEM).getSetting(SettingsFile.KEY_INIT_TIME);
|
||||||
} else {
|
} else {
|
||||||
mView.passSettingsToActivity(mSettings);
|
mView.passSettingsToActivity(mSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_REGION_VALUE, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.region, 0, R.array.regionNames, R.array.regionValues, -1, region));
|
sl.add(new SingleChoiceSetting(SettingsFile.KEY_REGION_VALUE, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.emulated_region, 0, R.array.regionNames, R.array.regionValues, -1, region));
|
||||||
|
sl.add(new SingleChoiceSetting(SettingsFile.KEY_LANGUAGE, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.emulated_language, 0, R.array.languageNames, R.array.languageValues, 1, language));
|
||||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_INIT_CLOCK, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.init_clock, R.string.init_clock_description, R.array.systemClockNames, R.array.systemClockValues, 0, systemClock));
|
sl.add(new SingleChoiceSetting(SettingsFile.KEY_INIT_CLOCK, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.init_clock, R.string.init_clock_description, R.array.systemClockNames, R.array.systemClockValues, 0, systemClock));
|
||||||
sl.add(new DateTimeSetting(SettingsFile.KEY_INIT_TIME, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.init_time, R.string.init_time_description, "2000-01-01 00:00:01", dateTime));
|
sl.add(new DateTimeSetting(SettingsFile.KEY_INIT_TIME, SettingsFile.SECTION_SYSTEM, SettingsFile.SETTINGS_DOLPHIN, R.string.init_time, R.string.init_time_description, "2000-01-01 00:00:01", dateTime));
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,8 @@ public final class SettingsFile {
|
|||||||
|
|
||||||
public static final String KEY_IS_NEW_3DS = "is_new_3ds";
|
public static final String KEY_IS_NEW_3DS = "is_new_3ds";
|
||||||
public static final String KEY_REGION_VALUE = "region_value";
|
public static final String KEY_REGION_VALUE = "region_value";
|
||||||
|
public static final String KEY_LANGUAGE = "language";
|
||||||
|
|
||||||
public static final String KEY_INIT_CLOCK = "init_clock";
|
public static final String KEY_INIT_CLOCK = "init_clock";
|
||||||
public static final String KEY_INIT_TIME = "init_time";
|
public static final String KEY_INIT_TIME = "init_time";
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
|
#include "core/core.h"
|
||||||
|
#include "core/hle/service/cfg/cfg.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
@ -60,6 +62,13 @@ static const std::array<int, Settings::NativeAnalog::NumAnalogs> default_analogs
|
|||||||
InputManager::N3DS_STICK_C,
|
InputManager::N3DS_STICK_C,
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
void Config::UpdateCFG() {
|
||||||
|
std::shared_ptr<Service::CFG::Module> cfg = std::make_shared<Service::CFG::Module>();
|
||||||
|
cfg->SetSystemLanguage(static_cast<Service::CFG::SystemLanguage>(
|
||||||
|
sdl2_config->GetInteger("System", "language", Service::CFG::SystemLanguage::LANGUAGE_EN)));
|
||||||
|
cfg->UpdateConfigNANDSavegame();
|
||||||
|
}
|
||||||
|
|
||||||
void Config::ReadValues() {
|
void Config::ReadValues() {
|
||||||
// Controls
|
// Controls
|
||||||
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
|
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
|
||||||
@ -230,6 +239,9 @@ void Config::ReadValues() {
|
|||||||
sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org");
|
sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org");
|
||||||
Settings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", "");
|
Settings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", "");
|
||||||
Settings::values.citra_token = sdl2_config->GetString("WebService", "citra_token", "");
|
Settings::values.citra_token = sdl2_config->GetString("WebService", "citra_token", "");
|
||||||
|
|
||||||
|
// Update CFG file based on settings
|
||||||
|
UpdateCFG();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Reload() {
|
void Config::Reload() {
|
||||||
|
@ -10,11 +10,13 @@
|
|||||||
class INIReader;
|
class INIReader;
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
|
private:
|
||||||
std::unique_ptr<INIReader> sdl2_config;
|
std::unique_ptr<INIReader> sdl2_config;
|
||||||
std::string sdl2_config_loc;
|
std::string sdl2_config_loc;
|
||||||
|
|
||||||
bool LoadINI(const std::string& default_contents = "", bool retry = true);
|
bool LoadINI(const std::string& default_contents = "", bool retry = true);
|
||||||
void ReadValues();
|
void ReadValues();
|
||||||
|
void UpdateCFG();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
|
@ -220,6 +220,11 @@ is_new_3ds =
|
|||||||
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
|
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
|
||||||
region_value =
|
region_value =
|
||||||
|
|
||||||
|
# The system language that Citra will use during emulation
|
||||||
|
# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish,
|
||||||
|
# 6: Simplified Chinese, 7: Korean, 8: Dutch, 9: Portuguese, 10: Russian, 11: Traditional Chinese
|
||||||
|
language =
|
||||||
|
|
||||||
# The clock to use when citra starts
|
# The clock to use when citra starts
|
||||||
# 0: System clock (default), 1: fixed time
|
# 0: System clock (default), 1: fixed time
|
||||||
init_clock =
|
init_clock =
|
||||||
|
@ -126,16 +126,16 @@ static int RunCitra(const std::string& filepath) {
|
|||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system{Core::System::GetInstance()};
|
||||||
SCOPE_EXIT({ system.Shutdown(); });
|
SCOPE_EXIT({ system.Shutdown(); });
|
||||||
|
|
||||||
// Register frontend applets
|
|
||||||
Frontend::RegisterDefaultApplets();
|
|
||||||
system.RegisterSoftwareKeyboard(std::make_shared<AndroidKeyboard>());
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Forces a config reload on game boot, if the user changed settings in the UI
|
// Forces a config reload on game boot, if the user changed settings in the UI
|
||||||
Config config;
|
Config config;
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register frontend applets
|
||||||
|
Frontend::RegisterDefaultApplets();
|
||||||
|
system.RegisterSoftwareKeyboard(std::make_shared<AndroidKeyboard>());
|
||||||
|
|
||||||
InputManager::Init();
|
InputManager::Init();
|
||||||
SCOPE_EXIT({ InputManager::Shutdown(); });
|
SCOPE_EXIT({ InputManager::Shutdown(); });
|
||||||
|
|
||||||
|
@ -34,6 +34,36 @@
|
|||||||
<item>6</item>
|
<item>6</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
|
<string-array name="languageNames">
|
||||||
|
<item>Japanese (日本語)</item>
|
||||||
|
<item>English</item>
|
||||||
|
<item>French (français)</item>
|
||||||
|
<item>German (Deutsch)</item>
|
||||||
|
<item>Italian (italiano)</item>
|
||||||
|
<item>Spanish (español)</item>
|
||||||
|
<item>Simplified Chinese (简体中文)</item>
|
||||||
|
<item>Korean (한국어)</item>
|
||||||
|
<item>Dutch (Nederlands)</item>
|
||||||
|
<item>Portuguese (português)</item>
|
||||||
|
<item>Russian (Русский)</item>
|
||||||
|
<item>Traditional Chinese (正體中文)</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<integer-array name="languageValues">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>8</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>11</item>
|
||||||
|
</integer-array>
|
||||||
|
|
||||||
<string-array name="countryNames">
|
<string-array name="countryNames">
|
||||||
<item>Europe</item>
|
<item>Europe</item>
|
||||||
<item>Japan</item>
|
<item>Japan</item>
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
<!-- System settings strings -->
|
<!-- System settings strings -->
|
||||||
<string name="init_time">System clock starting time override</string>
|
<string name="init_time">System clock starting time override</string>
|
||||||
<string name="init_time_description">If the \"System clock type\" setting is set to \"Simulated clock\", this changes the fixed date and time to start at.</string>
|
<string name="init_time_description">If the \"System clock type\" setting is set to \"Simulated clock\", this changes the fixed date and time to start at.</string>
|
||||||
<string name="region">Emulated region</string>
|
<string name="emulated_region">Emulated region</string>
|
||||||
|
<string name="emulated_language">Emulated language</string>
|
||||||
|
|
||||||
<!-- Graphics settings strings -->
|
<!-- Graphics settings strings -->
|
||||||
<string name="vsync">Enable V-Sync</string>
|
<string name="vsync">Enable V-Sync</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user