feat: add language select to settings

This commit is contained in:
goat 2020-06-08 18:07:43 +02:00
parent a9fa629e0b
commit a7687287fa
2 changed files with 25 additions and 9 deletions

View file

@ -30,8 +30,14 @@ namespace Dalamud.Interface
this.doPluginTest = this.dalamud.Configuration.DoPluginTest;
this.doDalamudTest = this.dalamud.Configuration.DoDalamudTest;
this.languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
this.langIndex = string.IsNullOrEmpty(this.dalamud.Configuration.LanguageOverride) ? 0 : Array.IndexOf(this.languages, this.dalamud.Configuration.LanguageOverride);
}
private string[] languages;
private int langIndex;
private string[] chatTypes;
private Vector4 hintTextColor = new Vector4(0.70f, 0.70f, 0.70f, 1.00f);
@ -52,7 +58,7 @@ namespace Dalamud.Interface
var isOpen = true;
if (!ImGui.Begin("XIVLauncher Settings", ref isOpen, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize)) {
if (!ImGui.Begin("Dalamud Settings", ref isOpen, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize)) {
ImGui.End();
return false;
}
@ -61,6 +67,13 @@ namespace Dalamud.Interface
if (ImGui.BeginTabBar("SetTabBar")) {
if (ImGui.BeginTabItem("General")) {
ImGui.Text("Language");
ImGui.Combo("##XlLangCombo", ref this.langIndex, this.languages,
this.languages.Length);
ImGui.TextColored(this.hintTextColor, "Select the language Dalamud will be displayed in.");
ImGui.Dummy(new Vector2(5f, 5f));
ImGui.Text("General Chat Channel");
ImGui.Combo("##XlChatTypeCombo", ref this.dalamudMessagesChatType, this.chatTypes,
this.chatTypes.Length);
@ -110,6 +123,9 @@ namespace Dalamud.Interface
}
private void Save() {
this.dalamud.LocalizationManager.SetupWithLangCode(this.languages[this.langIndex]);
this.dalamud.Configuration.LanguageOverride = this.languages[this.langIndex];
this.dalamud.Configuration.GeneralChatType = (XivChatType) this.dalamudMessagesChatType;
this.dalamud.Configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;