diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs
index 743069f..188d116 100755
--- a/ChatTwo/Configuration.cs
+++ b/ChatTwo/Configuration.cs
@@ -23,6 +23,7 @@ internal class Configuration : IPluginConfiguration {
public bool SidebarTabView;
public CommandHelpSide CommandHelpSide = CommandHelpSide.None;
public KeybindMode KeybindMode = KeybindMode.Strict;
+ public LanguageOverride LanguageOverride = LanguageOverride.None;
public bool CanMove = true;
public bool CanResize = true;
public bool ShowTitleBar;
@@ -49,6 +50,7 @@ internal class Configuration : IPluginConfiguration {
this.SidebarTabView = other.SidebarTabView;
this.CommandHelpSide = other.CommandHelpSide;
this.KeybindMode = other.KeybindMode;
+ this.LanguageOverride = other.LanguageOverride;
this.CanMove = other.CanMove;
this.CanResize = other.CanResize;
this.ShowTitleBar = other.ShowTitleBar;
@@ -207,3 +209,56 @@ internal static class KeybindModeExt {
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
};
+ internal static string? Tooltip(this KeybindMode mode) => mode switch {
+ KeybindMode.Flexible => Language.KeybindMode_Flexible_Tooltip,
+ KeybindMode.Strict => Language.KeybindMode_Strict_Tooltip,
+ _ => null,
+ };
+}
+
+[Serializable]
+internal enum LanguageOverride {
+ None,
+ English,
+ French,
+ German,
+ Italian,
+ Japanese,
+ Korean,
+ Norwegian,
+ PortugueseBrazil,
+ Russian,
+ Spanish,
+}
+
+internal static class LanguageOverrideExt {
+ internal static string Name(this LanguageOverride mode) => mode switch {
+ LanguageOverride.None => Language.LanguageOverride_None,
+ LanguageOverride.English => "English",
+ LanguageOverride.French => "Français",
+ LanguageOverride.German => "Deutsch",
+ LanguageOverride.Italian => "Italiano",
+ LanguageOverride.Japanese => "日本語",
+ LanguageOverride.Korean => "한국어 (Korean)",
+ LanguageOverride.Norwegian => "Norsk",
+ LanguageOverride.PortugueseBrazil => "Português do Brasil",
+ LanguageOverride.Russian => "Русский",
+ LanguageOverride.Spanish => "Español",
+ _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
+ };
+
+ internal static string Code(this LanguageOverride mode) => mode switch {
+ LanguageOverride.None => "",
+ LanguageOverride.English => "en",
+ LanguageOverride.French => "fr",
+ LanguageOverride.German => "de",
+ LanguageOverride.Italian => "it",
+ LanguageOverride.Japanese => "ja",
+ LanguageOverride.Korean => "ko",
+ LanguageOverride.Norwegian => "no",
+ LanguageOverride.PortugueseBrazil => "pt-br",
+ LanguageOverride.Russian => "ru",
+ LanguageOverride.Spanish => "es",
+ _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
+ };
+}
diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs
index e00a130..fe948ec 100755
--- a/ChatTwo/Plugin.cs
+++ b/ChatTwo/Plugin.cs
@@ -68,10 +68,11 @@ public sealed class Plugin : IDalamudPlugin {
#pragma warning disable CS8618
public Plugin() {
- LanguageChanged(this.Interface!.UiLanguage);
-
- this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
+ this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
this.Config.Migrate();
+
+ this.LanguageChanged(this.Interface.UiLanguage);
+
this.Common = new XivCommonBase();
this.TextureCache = new TextureCache(this.DataManager!);
this.Functions = new GameFunctions.GameFunctions(this);
@@ -79,12 +80,12 @@ public sealed class Plugin : IDalamudPlugin {
this.Ui = new PluginUi(this);
this.Framework!.Update += this.FrameworkUpdate;
- this.Interface.LanguageChanged += LanguageChanged;
+ this.Interface.LanguageChanged += this.LanguageChanged;
}
#pragma warning restore CS8618
public void Dispose() {
- this.Interface.LanguageChanged -= LanguageChanged;
+ this.Interface.LanguageChanged -= this.LanguageChanged;
this.Framework.Update -= this.FrameworkUpdate;
GameFunctions.GameFunctions.SetChatInteractable(true);
@@ -99,8 +100,12 @@ public sealed class Plugin : IDalamudPlugin {
this.Interface.SavePluginConfig(this.Config);
}
- private static void LanguageChanged(string langCode) {
- Language.Culture = new CultureInfo(langCode);
+ internal void LanguageChanged(string langCode) {
+ var info = this.Config.LanguageOverride is LanguageOverride.None
+ ? new CultureInfo(langCode)
+ : new CultureInfo(this.Config.LanguageOverride.Code());
+
+ Language.Culture = info;
}
private static readonly string[] ChatAddonNames = {
diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs
index 58f27a6..313d611 100755
--- a/ChatTwo/Resources/Language.Designer.cs
+++ b/ChatTwo/Resources/Language.Designer.cs
@@ -249,6 +249,51 @@ namespace ChatTwo.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Flexible.
+ ///
+ internal static string KeybindMode_Flexible_Name {
+ get {
+ return ResourceManager.GetString("KeybindMode_Flexible_Name", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Process keybinds with modifiers even if other modifiers are pressed..
+ ///
+ internal static string KeybindMode_Flexible_Tooltip {
+ get {
+ return ResourceManager.GetString("KeybindMode_Flexible_Tooltip", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Strict.
+ ///
+ internal static string KeybindMode_Strict_Name {
+ get {
+ return ResourceManager.GetString("KeybindMode_Strict_Name", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Only process keybinds with modifiers if no other modifiers are pressed..
+ ///
+ internal static string KeybindMode_Strict_Tooltip {
+ get {
+ return ResourceManager.GetString("KeybindMode_Strict_Tooltip", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Use Dalamud's default language.
+ ///
+ internal static string LanguageOverride_None {
+ get {
+ return ResourceManager.GetString("LanguageOverride_None", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Click the button to the left to see what's being worked on and what's next..
///
@@ -510,6 +555,51 @@ namespace ChatTwo.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to The way in which {0} should handle keybinds..
+ ///
+ internal static string Options_KeybindMode_Description {
+ get {
+ return ResourceManager.GetString("Options_KeybindMode_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Keybind mode.
+ ///
+ internal static string Options_KeybindMode_Name {
+ get {
+ return ResourceManager.GetString("Options_KeybindMode_Name", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The language to display {0} in..
+ ///
+ internal static string Options_Language_Description {
+ get {
+ return ResourceManager.GetString("Options_Language_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Language.
+ ///
+ internal static string Options_Language_Name {
+ get {
+ return ResourceManager.GetString("Options_Language_Name", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Miscellaneous.
+ ///
+ internal static string Options_Miscellaneous_Tab {
+ get {
+ return ResourceManager.GetString("Options_Miscellaneous_Tab", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Reduce the spacing between messages..
///
diff --git a/ChatTwo/Resources/Language.pt.resx b/ChatTwo/Resources/Language.pt-BR.resx
similarity index 100%
rename from ChatTwo/Resources/Language.pt.resx
rename to ChatTwo/Resources/Language.pt-BR.resx
diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx
index 15b8bdb..2a6923c 100755
--- a/ChatTwo/Resources/Language.resx
+++ b/ChatTwo/Resources/Language.resx
@@ -407,4 +407,34 @@
Hide {0} when the game UI is hidden.
+
+ Keybind mode
+
+
+ The way in which {0} should handle keybinds.
+
+
+ Miscellaneous
+
+
+ Use Dalamud's default language
+
+
+ Flexible
+
+
+ Strict
+
+
+ Process keybinds with modifiers even if other modifiers are pressed.
+
+
+ Only process keybinds with modifiers if no other modifiers are pressed.
+
+
+ Language
+
+
+ The language to display {0} in.
+
diff --git a/ChatTwo/Resources/Language.ru.resx b/ChatTwo/Resources/Language.ru.resx
index bd1c261..084fd58 100755
--- a/ChatTwo/Resources/Language.ru.resx
+++ b/ChatTwo/Resources/Language.ru.resx
@@ -398,12 +398,12 @@
Сторона помощи по команде
- Сторона {0} с которой отображается помощь по командам.
+ Сторона {0}, на которой отображается помощь по командам.
Скрывать, когда игровой интерфейс скрыт
- Скрыть {0}, когда игровой интерфейс скрыт.
+ Скрыть {0}, когда скрыт игровой интерфейс.
diff --git a/ChatTwo/Ui/Settings.cs b/ChatTwo/Ui/Settings.cs
index f0de410..9b36426 100755
--- a/ChatTwo/Ui/Settings.cs
+++ b/ChatTwo/Ui/Settings.cs
@@ -132,6 +132,7 @@ internal sealed class Settings : IUiComponent {
var fontSizeChanged = Math.Abs(this.Mutable.FontSize - this.Ui.Plugin.Config.FontSize) > 0.001
|| Math.Abs(this.Mutable.JapaneseFontSize - this.Ui.Plugin.Config.JapaneseFontSize) > 0.001
|| Math.Abs(this.Mutable.SymbolsFontSize - this.Ui.Plugin.Config.SymbolsFontSize) > 0.001;
+ var langChanged = this.Mutable.LanguageOverride != this.Ui.Plugin.Config.LanguageOverride;
config.UpdateFrom(this.Mutable);
@@ -145,6 +146,10 @@ internal sealed class Settings : IUiComponent {
this.Ui.Plugin.Interface.UiBuilder.RebuildFonts();
}
+ if (langChanged) {
+ this.Ui.Plugin.LanguageChanged(this.Ui.Plugin.Interface.UiLanguage);
+ }
+
if (!this.Mutable.HideChat && hideChatChanged) {
GameFunctions.GameFunctions.SetChatInteractable(true);
}
diff --git a/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs b/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs
index d959197..24d8935 100755
--- a/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs
+++ b/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs
@@ -14,6 +14,16 @@ internal sealed class Miscellaneous : ISettingsTab {
}
public void Draw() {
+ if (ImGui.BeginCombo(Language.Options_Language_Name, this.Mutable.LanguageOverride.Name())) {
+ foreach (var language in Enum.GetValues()) {
+ if (ImGui.Selectable(language.Name())) {
+ this.Mutable.LanguageOverride = language;
+ }
+ }
+
+ ImGui.EndCombo();
+ }
+
ImGuiUtil.HelpText(string.Format(Language.Options_Language_Description, Plugin.PluginName));
ImGui.Spacing();