minimal polishing up

This commit is contained in:
2023-01-11 08:42:21 +01:00
parent fa567b5985
commit c24d7f3ddb
5 changed files with 20 additions and 12 deletions

View File

@@ -1202,7 +1202,7 @@ namespace PlayerTags.Configuration
var entryName = Enum.GetName(typeofEnum, entry.Value);
var tempval = entry.Enabled;
isClicked = ImGui.Checkbox(Localizer.GetString(entryName), ref isDisabled ? ref tempval : ref entry.Enabled);
isClicked = ImGui.Checkbox(Localizer.GetString(entryName, false), ref isDisabled ? ref tempval : ref entry.Enabled);
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Localizer.GetString(entryName, true));

View File

@@ -2,14 +2,13 @@
using Dalamud.Plugin;
using PlayerTags.Resources;
using System;
using System.ComponentModel;
using System.Globalization;
namespace PlayerTags
{
public static class Localizer
{
private static CultureInfo culture = null;
public static void SetLanguage(string langCode)
{
SetLanguage(new CultureInfo(langCode));
@@ -17,7 +16,7 @@ namespace PlayerTags
public static void SetLanguage(CultureInfo cultureInfo)
{
culture = cultureInfo;
Strings.Culture = cultureInfo;
}
public static string GetName<TEnum>(TEnum value)
@@ -51,11 +50,10 @@ namespace PlayerTags
public static string GetString(string localizedStringId)
{
string? value = Strings.ResourceManager.GetString(localizedStringId, culture ?? Strings.Culture);
string? value = Strings.ResourceManager.GetString(localizedStringId, Strings.Culture);
if (value != null)
{
return value;
}
PluginLog.Error($"Failed to get localized string for id {localizedStringId}");
return localizedStringId;

View File

@@ -40,10 +40,10 @@ namespace PlayerTags
PluginServices.DalamudPluginInterface.UiBuilder.Draw += UiBuilder_Draw;
PluginServices.DalamudPluginInterface.UiBuilder.OpenConfigUi += UiBuilder_OpenConfigUi;
PluginServices.CommandManager.AddHandler(c_CommandName, new CommandInfo((string command, string arguments) =>
PluginServices.CommandManager.AddHandler(c_CommandName, new CommandInfo((string command, string arguments) => UiBuilder_OpenConfigUi())
{
UiBuilder_OpenConfigUi();
}) { HelpMessage = "Shows the config" });
HelpMessage = Resources.Strings.Loc_Command_playertags
});
m_CustomTagsContextMenuFeature = new CustomTagsContextMenuFeature(m_PluginConfiguration, m_PluginData);
m_NameplatesTagTargetFeature = new NameplateTagTargetFeature(m_PluginConfiguration, m_PluginData);
m_ChatTagTargetFeature = new ChatTagTargetFeature(m_PluginConfiguration, m_PluginData);
@@ -68,9 +68,7 @@ namespace PlayerTags
private void UiBuilder_Draw()
{
if (m_PluginConfiguration.IsVisible)
{
m_PluginConfigurationUI.Draw();
}
}
private void UiBuilder_OpenConfigUi()

View File

@@ -186,6 +186,15 @@ namespace PlayerTags.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Shows the config window for Player Tags ähnelt.
/// </summary>
public static string Loc_Command_playertags {
get {
return ResourceManager.GetString("Loc_Command_playertags", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Custom id ähnelt.
/// </summary>

View File

@@ -829,4 +829,7 @@ Use this if you want to to have every option under your control or just want to
<value>When enabled the Tag will apply to all Chat messages that has not a defined type.
This case can happen either if the Game updates and the Enumeration of all Chat Types gets invalid due to shifted values, or plugins creates a custom chat type for whatever reason.</value>
</data>
<data name="Loc_Command_playertags" xml:space="preserve">
<value>Shows the config window for Player Tags</value>
</data>
</root>