feat: prettier settings, start using resources file

This commit is contained in:
Anna 2022-02-04 05:46:13 -05:00
parent 61243096ec
commit bf742cd5a4
11 changed files with 877 additions and 45 deletions

View File

@ -58,4 +58,19 @@
<EmbeddedResource Include="fonts\NotoSansJP-Regular.otf"/>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Language.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Language.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Language.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Language.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,4 +1,5 @@
using ChatTwo.Code;
using ChatTwo.Resources;
using Dalamud.Configuration;
namespace ChatTwo;
@ -61,16 +62,16 @@ internal enum UnreadMode {
internal static class UnreadModeExt {
internal static string? Tooltip(this UnreadMode mode) => mode switch {
UnreadMode.All => "Always show unread indicators.",
UnreadMode.Unseen => "Only show unread indicators for messages you haven't seen.",
UnreadMode.None => "Never show unread indicators.",
UnreadMode.All => Language.UnreadMode_All_Tooltip,
UnreadMode.Unseen => Language.UnreadMode_Unseen_Tooltip,
UnreadMode.None => Language.UnreadMode_None_Tooltip,
_ => null,
};
}
[Serializable]
internal class Tab {
public string Name = "New tab";
public string Name = Language.Tab_DefaultName;
public Dictionary<ChatType, ChatSource> ChatCodes = new();
[Obsolete("Use UnreadMode instead")]

View File

@ -1,4 +1,6 @@
using Dalamud.Data;
using System.Globalization;
using ChatTwo.Resources;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Conditions;
@ -65,6 +67,8 @@ 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.Migrate();
this.Common = new XivCommonBase();
@ -74,10 +78,12 @@ public sealed class Plugin : IDalamudPlugin {
this.Ui = new PluginUi(this);
this.Framework!.Update += this.FrameworkUpdate;
this.Interface.LanguageChanged += LanguageChanged;
}
#pragma warning restore CS8618
public void Dispose() {
this.Interface.LanguageChanged -= LanguageChanged;
this.Framework.Update -= this.FrameworkUpdate;
GameFunctions.GameFunctions.SetChatInteractable(true);
@ -92,6 +98,10 @@ public sealed class Plugin : IDalamudPlugin {
this.Interface.SavePluginConfig(this.Config);
}
private static void LanguageChanged(string langCode) {
Language.Culture = new CultureInfo(langCode);
}
private static readonly string[] ChatAddonNames = {
"ChatLog",
"ChatLogPanel_0",

504
ChatTwo/Resources/Language.Designer.cs generated Executable file
View File

@ -0,0 +1,504 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChatTwo.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Language {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Language() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChatTwo.resources.Language", typeof(Language).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Hide chat.
/// </summary>
internal static string ChatLog_HideChat {
get {
return ResourceManager.GetString("ChatLog_HideChat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disabled for this tab..
/// </summary>
internal static string ChatLog_SwitcherDisabled {
get {
return ResourceManager.GetString("ChatLog_SwitcherDisabled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move down.
/// </summary>
internal static string ChatLog_Tabs_MoveDown {
get {
return ResourceManager.GetString("ChatLog_Tabs_MoveDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move left.
/// </summary>
internal static string ChatLog_Tabs_MoveLeft {
get {
return ResourceManager.GetString("ChatLog_Tabs_MoveLeft", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move right.
/// </summary>
internal static string ChatLog_Tabs_MoveRight {
get {
return ResourceManager.GetString("ChatLog_Tabs_MoveRight", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move up.
/// </summary>
internal static string ChatLog_Tabs_MoveUp {
get {
return ResourceManager.GetString("ChatLog_Tabs_MoveUp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Allow moving chat.
/// </summary>
internal static string Options_CanMove_Name {
get {
return ResourceManager.GetString("Options_CanMove_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Allow resizing chat.
/// </summary>
internal static string Options_CanResize_Name {
get {
return ResourceManager.GetString("Options_CanResize_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import from game.
/// </summary>
internal static string Options_ChatColours_Import {
get {
return ResourceManager.GetString("Options_ChatColours_Import", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reset to default.
/// </summary>
internal static string Options_ChatColours_Reset {
get {
return ResourceManager.GetString("Options_ChatColours_Reset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chat colours.
/// </summary>
internal static string Options_ChatColours_Tab {
get {
return ResourceManager.GetString("Options_ChatColours_Tab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Display.
/// </summary>
internal static string Options_Display_Tab {
get {
return ResourceManager.GetString("Options_Display_Tab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Font size.
/// </summary>
internal static string Options_FontSize_Name {
get {
return ResourceManager.GetString("Options_FontSize_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide the in-game chat window when the plugin is active..
/// </summary>
internal static string Options_HideChat_Description {
get {
return ResourceManager.GetString("Options_HideChat_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide vanilla chat.
/// </summary>
internal static string Options_HideChat_Name {
get {
return ResourceManager.GetString("Options_HideChat_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide Chat 2 during cutscenes..
/// </summary>
internal static string Options_HideDuringCutscenes_Description {
get {
return ResourceManager.GetString("Options_HideDuringCutscenes_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide chat during cutscenes.
/// </summary>
internal static string Options_HideDuringCutscenes_Name {
get {
return ResourceManager.GetString("Options_HideDuringCutscenes_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reduce the spacing between messages..
/// </summary>
internal static string Options_MoreCompactPretty_Description {
get {
return ResourceManager.GetString("Options_MoreCompactPretty_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to More compact modern layout.
/// </summary>
internal static string Options_MoreCompactPretty_Name {
get {
return ResourceManager.GetString("Options_MoreCompactPretty_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show in-game item tooltips when hovering over items in Chat 2..
/// </summary>
internal static string Options_NativeItemTooltips_Description {
get {
return ResourceManager.GetString("Options_NativeItemTooltips_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show native item tooltips.
/// </summary>
internal static string Options_NativeItemTooltips_Name {
get {
return ResourceManager.GetString("Options_NativeItemTooltips_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use a more modern style of displaying messages..
/// </summary>
internal static string Options_PrettierTimestamps_Description {
get {
return ResourceManager.GetString("Options_PrettierTimestamps_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use modern timestamp layout.
/// </summary>
internal static string Options_PrettierTimestamps_Name {
get {
return ResourceManager.GetString("Options_PrettierTimestamps_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show the Novice Network join button next to the settings button if logged in as a mentor..
/// </summary>
internal static string Options_ShowNoviceNetwork_Description {
get {
return ResourceManager.GetString("Options_ShowNoviceNetwork_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show Novice Network join button.
/// </summary>
internal static string Options_ShowNoviceNetwork_Name {
get {
return ResourceManager.GetString("Options_ShowNoviceNetwork_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show title bar for chat.
/// </summary>
internal static string Options_ShowTitleBar_Name {
get {
return ResourceManager.GetString("Options_ShowTitleBar_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show tabs in Chat 2 as a sidebar instead of a bar at the top..
/// </summary>
internal static string Options_SidebarTabView_Description {
get {
return ResourceManager.GetString("Options_SidebarTabView_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show tabs in a sidebar.
/// </summary>
internal static string Options_SidebarTabView_Name {
get {
return ResourceManager.GetString("Options_SidebarTabView_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add.
/// </summary>
internal static string Options_Tabs_Add {
get {
return ResourceManager.GetString("Options_Tabs_Add", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Channels.
/// </summary>
internal static string Options_Tabs_Channels {
get {
return ResourceManager.GetString("Options_Tabs_Channels", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Delete.
/// </summary>
internal static string Options_Tabs_Delete {
get {
return ResourceManager.GetString("Options_Tabs_Delete", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Input channel.
/// </summary>
internal static string Options_Tabs_InputChannel {
get {
return ResourceManager.GetString("Options_Tabs_InputChannel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move down.
/// </summary>
internal static string Options_Tabs_MoveDown {
get {
return ResourceManager.GetString("Options_Tabs_MoveDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Move up.
/// </summary>
internal static string Options_Tabs_MoveUp {
get {
return ResourceManager.GetString("Options_Tabs_MoveUp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
internal static string Options_Tabs_Name {
get {
return ResourceManager.GetString("Options_Tabs_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;None&gt;.
/// </summary>
internal static string Options_Tabs_NoInputChannel {
get {
return ResourceManager.GetString("Options_Tabs_NoInputChannel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show timestamps.
/// </summary>
internal static string Options_Tabs_ShowTimestamps {
get {
return ResourceManager.GetString("Options_Tabs_ShowTimestamps", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Tabs.
/// </summary>
internal static string Options_Tabs_Tab {
get {
return ResourceManager.GetString("Options_Tabs_Tab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unread mode.
/// </summary>
internal static string Options_Tabs_UnreadMode {
get {
return ResourceManager.GetString("Options_Tabs_UnreadMode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Window opacity.
/// </summary>
internal static string Options_WindowOpacity_Name {
get {
return ResourceManager.GetString("Options_WindowOpacity_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Discard.
/// </summary>
internal static string Settings_Discard {
get {
return ResourceManager.GetString("Settings_Discard", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Support {0} on Ko-fi.
/// </summary>
internal static string Settings_Kofi {
get {
return ResourceManager.GetString("Settings_Kofi", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save.
/// </summary>
internal static string Settings_Save {
get {
return ResourceManager.GetString("Settings_Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save and close.
/// </summary>
internal static string Settings_SaveAndClose {
get {
return ResourceManager.GetString("Settings_SaveAndClose", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} settings.
/// </summary>
internal static string Settings_Title {
get {
return ResourceManager.GetString("Settings_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New tab.
/// </summary>
internal static string Tab_DefaultName {
get {
return ResourceManager.GetString("Tab_DefaultName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Always show unread indicators..
/// </summary>
internal static string UnreadMode_All_Tooltip {
get {
return ResourceManager.GetString("UnreadMode_All_Tooltip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Never show unread indicators..
/// </summary>
internal static string UnreadMode_None_Tooltip {
get {
return ResourceManager.GetString("UnreadMode_None_Tooltip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Only show unread indicators for messages you haven&apos;t seen..
/// </summary>
internal static string UnreadMode_Unseen_Tooltip {
get {
return ResourceManager.GetString("UnreadMode_Unseen_Tooltip", resourceCulture);
}
}
}
}

272
ChatTwo/Resources/Language.resx Executable file
View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="mimetype" type="xsd:string"/>
<xsd:attribute ref="xml:space"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
<xsd:attribute ref="xml:space"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="Options_HideChat_Name" xml:space="preserve">
<value>Hide vanilla chat</value>
</data>
<data name="Options_HideChat_Description" xml:space="preserve">
<value>Hide the in-game chat window when the plugin is active.</value>
</data>
<data name="Options_HideDuringCutscenes_Name" xml:space="preserve">
<value>Hide chat during cutscenes</value>
</data>
<data name="Options_HideDuringCutscenes_Description" xml:space="preserve">
<value>Hide Chat 2 during cutscenes.</value>
</data>
<data name="Options_NativeItemTooltips_Name" xml:space="preserve">
<value>Show native item tooltips</value>
</data>
<data name="Options_NativeItemTooltips_Description" xml:space="preserve">
<value>Show in-game item tooltips when hovering over items in Chat 2.</value>
</data>
<data name="Options_SidebarTabView_Name" xml:space="preserve">
<value>Show tabs in a sidebar</value>
</data>
<data name="Options_SidebarTabView_Description" xml:space="preserve">
<value>Show tabs in Chat 2 as a sidebar instead of a bar at the top.</value>
</data>
<data name="Options_PrettierTimestamps_Name" xml:space="preserve">
<value>Use modern timestamp layout</value>
</data>
<data name="Options_PrettierTimestamps_Description" xml:space="preserve">
<value>Use a more modern style of displaying messages.</value>
</data>
<data name="Options_MoreCompactPretty_Name" xml:space="preserve">
<value>More compact modern layout</value>
</data>
<data name="Options_MoreCompactPretty_Description" xml:space="preserve">
<value>Reduce the spacing between messages.</value>
</data>
<data name="Options_ShowNoviceNetwork_Name" xml:space="preserve">
<value>Show Novice Network join button</value>
</data>
<data name="Options_ShowNoviceNetwork_Description" xml:space="preserve">
<value>Show the Novice Network join button next to the settings button if logged in as a mentor.</value>
</data>
<data name="Options_FontSize_Name" xml:space="preserve">
<value>Font size</value>
</data>
<data name="Options_WindowOpacity_Name" xml:space="preserve">
<value>Window opacity</value>
</data>
<data name="Options_CanMove_Name" xml:space="preserve">
<value>Allow moving chat</value>
</data>
<data name="Options_CanResize_Name" xml:space="preserve">
<value>Allow resizing chat</value>
</data>
<data name="Options_ShowTitleBar_Name" xml:space="preserve">
<value>Show title bar for chat</value>
</data>
<data name="Options_Display_Tab" xml:space="preserve">
<value>Display</value>
</data>
<data name="Options_ChatColours_Tab" xml:space="preserve">
<value>Chat colours</value>
</data>
<data name="Options_ChatColours_Reset" xml:space="preserve">
<value>Reset to default</value>
</data>
<data name="Options_ChatColours_Import" xml:space="preserve">
<value>Import from game</value>
</data>
<data name="Options_Tabs_Tab" xml:space="preserve">
<value>Tabs</value>
</data>
<data name="Options_Tabs_Add" xml:space="preserve">
<value>Add</value>
</data>
<data name="Options_Tabs_Delete" xml:space="preserve">
<value>Delete</value>
</data>
<data name="Options_Tabs_MoveUp" xml:space="preserve">
<value>Move up</value>
</data>
<data name="Options_Tabs_MoveDown" xml:space="preserve">
<value>Move down</value>
</data>
<data name="Options_Tabs_Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Options_Tabs_ShowTimestamps" xml:space="preserve">
<value>Show timestamps</value>
</data>
<data name="Options_Tabs_UnreadMode" xml:space="preserve">
<value>Unread mode</value>
</data>
<data name="Options_Tabs_NoInputChannel" xml:space="preserve">
<value>&lt;None&gt;</value>
</data>
<data name="Options_Tabs_InputChannel" xml:space="preserve">
<value>Input channel</value>
</data>
<data name="Options_Tabs_Channels" xml:space="preserve">
<value>Channels</value>
</data>
<data name="UnreadMode_All_Tooltip" xml:space="preserve">
<value>Always show unread indicators.</value>
</data>
<data name="UnreadMode_Unseen_Tooltip" xml:space="preserve">
<value>Only show unread indicators for messages you haven't seen.</value>
</data>
<data name="UnreadMode_None_Tooltip" xml:space="preserve">
<value>Never show unread indicators.</value>
</data>
<data name="Tab_DefaultName" xml:space="preserve">
<value>New tab</value>
</data>
<data name="Settings_Kofi" xml:space="preserve">
<value>Support {0} on Ko-fi</value>
</data>
<data name="Settings_SaveAndClose" xml:space="preserve">
<value>Save and close</value>
</data>
<data name="Settings_Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="Settings_Discard" xml:space="preserve">
<value>Discard</value>
</data>
<data name="Settings_Title" xml:space="preserve">
<value>{0} settings</value>
</data>
<data name="ChatLog_SwitcherDisabled" xml:space="preserve">
<value>Disabled for this tab.</value>
</data>
<data name="ChatLog_HideChat" xml:space="preserve">
<value>Hide chat</value>
</data>
<data name="ChatLog_Tabs_MoveUp" xml:space="preserve">
<value>Move up</value>
</data>
<data name="ChatLog_Tabs_MoveLeft" xml:space="preserve">
<value>Move left</value>
</data>
<data name="ChatLog_Tabs_MoveDown" xml:space="preserve">
<value>Move down</value>
</data>
<data name="ChatLog_Tabs_MoveRight" xml:space="preserve">
<value>Move right</value>
</data>
</root>

View File

@ -2,6 +2,7 @@
using System.Numerics;
using ChatTwo.Code;
using ChatTwo.GameFunctions.Types;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Keys;
@ -383,7 +384,7 @@ internal sealed class ChatLog : IUiComponent {
if (activeTab is { Channel: { } } && ImGui.IsItemHovered()) {
ImGui.BeginTooltip();
ImGui.TextUnformatted("Disabled for this tab.");
ImGui.TextUnformatted(Language.ChatLog_SwitcherDisabled);
ImGui.EndTooltip();
}
@ -486,7 +487,7 @@ internal sealed class ChatLog : IUiComponent {
ImGui.PushStyleColor(ImGuiCol.Text, normalColour);
try {
if (ImGui.Selectable("Hide chat")) {
if (ImGui.Selectable(Language.ChatLog_HideChat)) {
this.UserHide();
}
} finally {
@ -754,8 +755,8 @@ internal sealed class ChatLog : IUiComponent {
ImGui.SameLine();
var (leftIcon, leftTooltip) = this.Ui.Plugin.Config.SidebarTabView
? (FontAwesomeIcon.ArrowUp, "Move up")
: ((FontAwesomeIcon) 61536, "Move left");
? (FontAwesomeIcon.ArrowUp, Language.ChatLog_Tabs_MoveUp)
: (FontAwesomeIcon.ArrowLeft, Language.ChatLog_Tabs_MoveLeft);
if (ImGuiUtil.IconButton(leftIcon, tooltip: leftTooltip) && i > 0) {
(tabs[i - 1], tabs[i]) = (tabs[i], tabs[i - 1]);
ImGui.CloseCurrentPopup();
@ -765,8 +766,8 @@ internal sealed class ChatLog : IUiComponent {
ImGui.SameLine();
var (rightIcon, rightTooltip) = this.Ui.Plugin.Config.SidebarTabView
? (FontAwesomeIcon.ArrowDown, "Move down")
: (FontAwesomeIcon.ArrowRight, "Move right");
? (FontAwesomeIcon.ArrowDown, Language.ChatLog_Tabs_MoveDown)
: (FontAwesomeIcon.ArrowRight, Language.ChatLog_Tabs_MoveRight);
if (ImGuiUtil.IconButton(rightIcon, tooltip: rightTooltip) && i < tabs.Count - 1) {
(tabs[i + 1], tabs[i]) = (tabs[i], tabs[i + 1]);
ImGui.CloseCurrentPopup();

View File

@ -1,8 +1,10 @@
using System.Diagnostics;
using System.Numerics;
using ChatTwo.Resources;
using ChatTwo.Ui.SettingsTabs;
using ChatTwo.Util;
using Dalamud.Game.Command;
using Dalamud.Interface;
using ImGuiNET;
namespace ChatTwo.Ui;
@ -45,7 +47,9 @@ internal sealed class Settings : IUiComponent {
return;
}
if (!ImGui.Begin($"{this.Ui.Plugin.Name} settings", ref this.Ui.SettingsVisible)) {
ImGui.SetNextWindowSize(new Vector2(500, 650) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
if (!ImGui.Begin(string.Format(Language.Settings_Title, this.Ui.Plugin.Name), ref this.Ui.SettingsVisible)) {
ImGui.End();
return;
}
@ -78,22 +82,22 @@ internal sealed class Settings : IUiComponent {
ImGui.Separator();
var save = ImGui.Button("Save");
var save = ImGui.Button(Language.Settings_Save);
ImGui.SameLine();
if (ImGui.Button("Save and close")) {
if (ImGui.Button(Language.Settings_SaveAndClose)) {
save = true;
this.Ui.SettingsVisible = false;
}
ImGui.SameLine();
if (ImGui.Button("Discard")) {
if (ImGui.Button(Language.Settings_Discard)) {
this.Ui.SettingsVisible = false;
}
var buttonLabel = $"Support {this.Ui.Plugin.Name} on Ko-fi";
var buttonLabel = string.Format(Language.Settings_Kofi, this.Ui.Plugin.Name);
ImGui.PushStyleColor(ImGuiCol.Button, ColourUtil.RgbaToAbgr(0xFF5E5BFF));
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, ColourUtil.RgbaToAbgr(0xFF7775FF));

View File

@ -1,4 +1,5 @@
using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Interface;
using ImGuiNET;
@ -9,7 +10,7 @@ internal sealed class ChatColours : ISettingsTab {
private Configuration Mutable { get; }
private Plugin Plugin { get; }
public string Name => "Chat colours";
public string Name => Language.Options_ChatColours_Tab;
internal ChatColours(Configuration mutable, Plugin plugin) {
this.Mutable = mutable;
@ -18,13 +19,13 @@ internal sealed class ChatColours : ISettingsTab {
public void Draw() {
foreach (var type in Enum.GetValues<ChatType>()) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", "Reset to default")) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) {
this.Mutable.ChatColours.Remove(type);
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", "Import from game")) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import)) {
var gameColour = this.Plugin.Functions.Chat.GetChannelColour(type);
this.Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0;
}

View File

@ -1,31 +1,35 @@
using ImGuiNET;
using ChatTwo.Resources;
using ChatTwo.Util;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Display : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Display";
public string Name => Language.Options_Display_Tab;
internal Display(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
ImGui.Checkbox("Hide vanilla chat", ref this.Mutable.HideChat);
ImGui.Checkbox("Hide chat during cutscenes", ref this.Mutable.HideDuringCutscenes);
ImGui.Checkbox("Show native item tooltips", ref this.Mutable.NativeItemTooltips);
ImGui.Checkbox("Show tabs in a sidebar", ref this.Mutable.SidebarTabView);
ImGui.Checkbox("Use modern timestamp layout", ref this.Mutable.PrettierTimestamps);
ImGuiUtil.OptionCheckbox(ref this.Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description);
ImGuiUtil.OptionCheckbox(ref this.Mutable.HideDuringCutscenes, Language.Options_HideDuringCutscenes_Name, Language.Options_HideDuringCutscenes_Description);
ImGuiUtil.OptionCheckbox(ref this.Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, Language.Options_NativeItemTooltips_Description);
ImGuiUtil.OptionCheckbox(ref this.Mutable.SidebarTabView, Language.Options_SidebarTabView_Name, Language.Options_SidebarTabView_Description);
ImGuiUtil.OptionCheckbox(ref this.Mutable.PrettierTimestamps, Language.Options_PrettierTimestamps_Name, Language.Options_PrettierTimestamps_Description);
if (this.Mutable.PrettierTimestamps) {
ImGui.Checkbox("More compact modern layout", ref this.Mutable.MoreCompactPretty);
ImGui.TreePush();
ImGuiUtil.OptionCheckbox(ref this.Mutable.MoreCompactPretty, Language.Options_MoreCompactPretty_Name, Language.Options_MoreCompactPretty_Description);
ImGui.TreePop();
}
ImGui.Checkbox("Show Novice Network join button", ref this.Mutable.ShowNoviceNetwork);
ImGuiUtil.OptionCheckbox(ref this.Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description);
ImGui.DragFloat("Font size", ref this.Mutable.FontSize, .0125f, 12f, 36f, $"{this.Mutable.FontSize:N1}");
if (ImGui.DragFloat("Window opacity", ref this.Mutable.WindowAlpha, .0025f, 0f, 1f, $"{this.Mutable.WindowAlpha * 100f:N2}%%")) {
ImGui.DragFloat(Language.Options_FontSize_Name, ref this.Mutable.FontSize, .0125f, 12f, 36f, $"{this.Mutable.FontSize:N1}");
if (ImGui.DragFloat(Language.Options_WindowOpacity_Name, ref this.Mutable.WindowAlpha, .0025f, 0f, 1f, $"{this.Mutable.WindowAlpha * 100f:N2}%%")) {
switch (this.Mutable.WindowAlpha) {
case > 1f and <= 100f:
this.Mutable.WindowAlpha /= 100f;
@ -36,8 +40,8 @@ internal sealed class Display : ISettingsTab {
}
}
ImGui.Checkbox("Allow moving main window", ref this.Mutable.CanMove);
ImGui.Checkbox("Allow resizing main window", ref this.Mutable.CanResize);
ImGui.Checkbox("Show title bar for main window", ref this.Mutable.ShowTitleBar);
ImGuiUtil.OptionCheckbox(ref this.Mutable.CanMove, Language.Options_CanMove_Name);
ImGuiUtil.OptionCheckbox(ref this.Mutable.CanResize, Language.Options_CanResize_Name);
ImGuiUtil.OptionCheckbox(ref this.Mutable.ShowTitleBar, Language.Options_ShowTitleBar_Name);
}
}

View File

@ -1,4 +1,5 @@
using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Interface;
using ImGuiNET;
@ -8,14 +9,14 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Tabs : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Tabs";
public string Name => Language.Options_Tabs_Tab;
internal Tabs(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: "Add")) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: Language.Options_Tabs_Add)) {
this.Mutable.Tabs.Add(new Tab());
}
@ -26,26 +27,26 @@ internal sealed class Tabs : ISettingsTab {
if (ImGui.TreeNodeEx($"{tab.Name}###tab-{i}")) {
ImGui.PushID($"tab-{i}");
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: "Delete")) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.Options_Tabs_Delete)) {
toRemove = i;
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: "Move up") && i > 0) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: Language.Options_Tabs_MoveUp) && i > 0) {
(this.Mutable.Tabs[i - 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i - 1]);
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: "Move down") && i < this.Mutable.Tabs.Count - 1) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: Language.Options_Tabs_MoveDown) && i < this.Mutable.Tabs.Count - 1) {
(this.Mutable.Tabs[i + 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i + 1]);
}
ImGui.InputText("Name", ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
ImGui.Checkbox("Show timestamps", ref tab.DisplayTimestamp);
ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
ImGui.Checkbox(Language.Options_Tabs_ShowTimestamps, ref tab.DisplayTimestamp);
if (ImGui.BeginCombo("Unread mode", tab.UnreadMode.ToString())) {
if (ImGui.BeginCombo(Language.Options_Tabs_UnreadMode, tab.UnreadMode.ToString())) {
foreach (var mode in Enum.GetValues<UnreadMode>()) {
if (ImGui.Selectable(mode.ToString(), tab.UnreadMode == mode)) {
tab.UnreadMode = mode;
@ -61,9 +62,9 @@ internal sealed class Tabs : ISettingsTab {
ImGui.EndCombo();
}
var input = tab.Channel?.ToChatType().Name() ?? "<None>";
if (ImGui.BeginCombo("Input channel", input)) {
if (ImGui.Selectable("<None>", tab.Channel == null)) {
var input = tab.Channel?.ToChatType().Name() ?? Language.Options_Tabs_NoInputChannel;
if (ImGui.BeginCombo(Language.Options_Tabs_InputChannel, input)) {
if (ImGui.Selectable(Language.Options_Tabs_NoInputChannel, tab.Channel == null)) {
tab.Channel = null;
}
@ -76,7 +77,7 @@ internal sealed class Tabs : ISettingsTab {
ImGui.EndCombo();
}
if (ImGui.TreeNodeEx("Channels")) {
if (ImGui.TreeNodeEx(Language.Options_Tabs_Channels)) {
foreach (var type in Enum.GetValues<ChatType>()) {
var enabled = tab.ChatCodes.ContainsKey(type);
if (ImGui.Checkbox($"##{type.Name()}-{i}", ref enabled)) {

View File

@ -105,4 +105,23 @@ internal static class ImGuiUtil {
return ret;
}
internal static bool OptionCheckbox(ref bool value, string label, string? description = null) {
var ret = ImGui.Checkbox(label, ref value);
if (description != null) {
var colour = ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled];
ImGui.PushStyleColor(ImGuiCol.Text, colour);
ImGui.PushTextWrapPos();
try {
ImGui.TextUnformatted(description);
} finally {
ImGui.PopTextWrapPos();
ImGui.PopStyleColor();
}
}
return ret;
}
}