loc: switch to using resources

This commit is contained in:
Anna 2021-04-27 23:36:57 -04:00
parent 12ffda14ec
commit 5a602a0c3e
13 changed files with 1146 additions and 398 deletions

View File

@ -1,8 +1,8 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using CheapLoc;
using NoSoliciting.Interface;
using NoSoliciting.Resources;
using XivCommon.Functions;
namespace NoSoliciting {
@ -24,7 +24,7 @@ namespace NoSoliciting {
return;
}
var label = Loc.Localize("ReportToNoSoliciting", "Report to NoSoliciting");
var label = Language.ReportToNoSoliciting;
args.AdditionalItems.Add(new ContextMenuItem(label, this.Report));
}
@ -50,12 +50,12 @@ namespace NoSoliciting {
var status = await this.Plugin.Ui.Report.ReportMessageAsync(message);
switch (status) {
case ReportStatus.Successful: {
var msg = Loc.Localize("ReportToastSuccess", "Party Finder listing hosted by {0} reported successfully.");
var msg = Language.ReportToastSuccess;
this.Plugin.Interface.Framework.Gui.Toast.ShowNormal(string.Format(msg, listing.Name));
break;
}
case ReportStatus.Failure: {
var msg = Loc.Localize("ReportToastFailure", "Failed to report Party Finder listing hosted by {0}.");
var msg = Language.ReportToastFailure;
this.Plugin.Interface.Framework.Gui.Toast.ShowError(string.Format(msg, listing.Name));
break;
}

View File

@ -5,6 +5,7 @@
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\NoSoliciting.dll"/>
<InputAssemblies Include="$(OutputPath)\NoSoliciting.Interface.dll"/>
<InputAssemblies Include="$(OutputPath)\*\NoSoliciting.resources.dll"/>
<InputAssemblies Include="$(OutputPath)\J*.dll"/>
<InputAssemblies Include="$(OutputPath)\M*.dll"/>
<InputAssemblies Include="$(OutputPath)\S*.dll"/>

View File

@ -5,11 +5,11 @@ using System.Net;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using CheapLoc;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Plugin;
using ImGuiNET;
using NoSoliciting.Resources;
namespace NoSoliciting.Interface {
public class Report {
@ -53,21 +53,21 @@ namespace NoSoliciting.Interface {
ImGui.SetNextWindowSize(new Vector2(1_000, 350), ImGuiCond.FirstUseEver);
var windowTitle = string.Format(Loc.Localize("Reporting", "{0} reporting"), this.Plugin.Name);
var windowTitle = string.Format(Language.Reporting, this.Plugin.Name);
if (!ImGui.Begin($"{windowTitle}###NoSoliciting reporting", ref this._showReporting)) {
return;
}
ImGui.TextUnformatted(Loc.Localize("ReportHelp", "Click on one of the entries below to report it to the developer as miscategorised."));
ImGui.TextUnformatted(Language.ReportHelp);
if (this.LastReportStatus != ReportStatus.None) {
var status = this.LastReportStatus switch {
ReportStatus.Failure => Loc.Localize("ReportStatusFailure", "failed to send"),
ReportStatus.Successful => Loc.Localize("ReportStatusSuccessful", "sent successfully"),
ReportStatus.InProgress => Loc.Localize("ReportStatusInProgress", "sending"),
_ => Loc.Localize("ReportStatusUnknown", "unknown"),
ReportStatus.Failure => Language.ReportStatusFailure,
ReportStatus.Successful => Language.ReportStatusSuccessful,
ReportStatus.InProgress => Language.ReportStatusInProgress,
_ => Language.ReportStatusUnknown,
};
var reportStatus = Loc.Localize("ReportStatusMessage", "Last report status: {0}");
var reportStatus = Language.ReportStatusMessage;
ImGui.TextUnformatted(string.Format(reportStatus, status));
}
@ -85,18 +85,18 @@ namespace NoSoliciting.Interface {
}
private void ChatTab() {
var tabTitle = Loc.Localize("ReportChatTab", "Chat");
var tabTitle = Language.ReportChatTab;
if (!ImGui.BeginTabItem($"{tabTitle}##chat-report")) {
return;
}
if (ImGui.BeginChild("##chat-messages", new Vector2(-1, -1))) {
if (ImGui.BeginTable("nosol-chat-report-table", 5, TableFlags)) {
ImGui.TableSetupColumn(Loc.Localize("ReportColumnTimestamp", "Timestamp"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnChannel", "Channel"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnReason", "Reason"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnSender", "Sender"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnMessage", "Message"), ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn(Language.ReportColumnTimestamp);
ImGui.TableSetupColumn(Language.ReportColumnChannel);
ImGui.TableSetupColumn(Language.ReportColumnReason);
ImGui.TableSetupColumn(Language.ReportColumnSender);
ImGui.TableSetupColumn(Language.ReportColumnMessage, ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableHeadersRow();
@ -134,7 +134,7 @@ namespace NoSoliciting.Interface {
}
private void PartyFinderTab() {
var tabTitle = Loc.Localize("ReportPartyFinderTab", "Party Finder");
var tabTitle = Language.ReportPartyFinderTab;
if (!ImGui.BeginTabItem($"{tabTitle}##pf-report")) {
return;
}
@ -157,10 +157,10 @@ namespace NoSoliciting.Interface {
if (ImGui.BeginChild("##pf-messages", new Vector2(-1, -1))) {
if (ImGui.BeginTable("nosol-pf-report-table", 4, TableFlags)) {
ImGui.TableSetupColumn(Loc.Localize("ReportColumnTimestamp", "Timestamp"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnReason", "Reason"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnHost", "Host"));
ImGui.TableSetupColumn(Loc.Localize("ReportColumnDescription", "Description"), ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn(Language.ReportColumnTimestamp);
ImGui.TableSetupColumn(Language.ReportColumnReason);
ImGui.TableSetupColumn(Language.ReportColumnHost);
ImGui.TableSetupColumn(Language.ReportColumnDescription, ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableHeadersRow();
@ -202,18 +202,18 @@ namespace NoSoliciting.Interface {
private void SetUpReportModal(Message message) {
ImGui.SetNextWindowSize(new Vector2(350, -1));
var modalTitle = string.Format(Loc.Localize("ReportModalTitle", "Report to {0}"), this.Plugin.Name);
var modalTitle = string.Format(Language.ReportModalTitle, this.Plugin.Name);
if (!ImGui.BeginPopupModal($"{modalTitle}###modal-message-{message.Id}")) {
return;
}
ImGui.PushTextWrapPos();
ImGui.TextUnformatted(Loc.Localize("ReportModalHelp1", "Reporting this message will let the developer know that you think this message was incorrectly classified."));
ImGui.TextUnformatted(Language.ReportModalHelp1);
ImGui.TextUnformatted(message.FilterReason != null
? Loc.Localize("ReportModalWasFiltered", "Specifically, this message WAS filtered but shouldn't have been.")
: Loc.Localize("ReportModalWasNotFiltered", "Specifically, this message WAS NOT filtered but should have been."));
? Language.ReportModalWasFiltered
: Language.ReportModalWasNotFiltered);
ImGui.Separator();
@ -222,17 +222,17 @@ namespace NoSoliciting.Interface {
ImGui.Separator();
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1f, 0f, 0f, 1f));
ImGui.TextUnformatted(Loc.Localize("ReportModalHelp2", "NoSoliciting only works for English messages. Do not report non-English messages."));
ImGui.TextUnformatted(Language.ReportModalHelp2);
ImGui.PopStyleColor();
ImGui.Separator();
if (message.FilterReason == "custom") {
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1f, 0f, 0f, 1f));
ImGui.TextUnformatted(Loc.Localize("ReportModalCustom", "You cannot report messages filtered because of a custom filter."));
ImGui.TextUnformatted(Language.ReportModalCustom);
ImGui.PopStyleColor();
} else {
var buttonTitle = Loc.Localize("ReportModalReport", "Report");
var buttonTitle =Language.ReportModalReport;
if (ImGui.Button($"{buttonTitle}##report-submit-{message.Id}")) {
this.ReportMessage(message);
ImGui.CloseCurrentPopup();
@ -241,7 +241,7 @@ namespace NoSoliciting.Interface {
ImGui.SameLine();
}
var copyButton = Loc.Localize("ReportModalCopy", "Copy to clipboard");
var copyButton = Language.ReportModalCopy;
if (ImGui.Button($"{copyButton}##report-copy-{message.Id}")) {
ImGui.SetClipboardText(message.Content.TextValue);
}
@ -255,7 +255,7 @@ namespace NoSoliciting.Interface {
ImGui.SameLine();
var cancelButton = Loc.Localize("ReportModalCancel", "Cancel");
var cancelButton = Language.ReportModalCancel;
if (ImGui.Button($"{cancelButton}##report-cancel-{message.Id}")) {
ImGui.CloseCurrentPopup();
}

View File

@ -2,10 +2,11 @@
using System.Collections.Generic;
using System.Numerics;
using System.Text.RegularExpressions;
using CheapLoc;
using Dalamud.Interface;
using Dalamud.Plugin;
using ImGuiNET;
using NoSoliciting.Ml;
using NoSoliciting.Resources;
namespace NoSoliciting.Interface {
public class Settings : IDisposable {
@ -39,13 +40,17 @@ namespace NoSoliciting.Interface {
}
public void Draw() {
var windowTitle = string.Format(Loc.Localize("Settings", "{0} settings"), this.Plugin.Name);
var windowTitle = string.Format(Language.Settings, this.Plugin.Name);
if (!this.ShowSettings || !ImGui.Begin($"{windowTitle}###NoSoliciting settings", ref this._showSettings)) {
return;
}
if (ImGui.Button("Log resource culture")) {
PluginLog.Log(Language.Culture.Name);
}
var advanced = this.Plugin.Config.AdvancedMode;
if (ImGui.Checkbox(Loc.Localize("AdvancedMode", "Advanced mode"), ref advanced)) {
if (ImGui.Checkbox(Language.AdvancedMode, ref advanced)) {
this.Plugin.Config.AdvancedMode = advanced;
this.Plugin.Config.Save();
}
@ -60,15 +65,15 @@ namespace NoSoliciting.Interface {
this.DrawOtherFilters();
if (ImGui.BeginTabItem(Loc.Localize("OtherTab", "Other"))) {
if (ImGui.BeginTabItem(Language.OtherTab)) {
var logFilteredPfs = this.Plugin.Config.LogFilteredPfs;
if (ImGui.Checkbox(Loc.Localize("LogFilteredPfs", "Log filtered PFs"), ref logFilteredPfs)) {
if (ImGui.Checkbox(Language.LogFilteredPfs, ref logFilteredPfs)) {
this.Plugin.Config.LogFilteredPfs = logFilteredPfs;
this.Plugin.Config.Save();
}
var logFilteredMessages = this.Plugin.Config.LogFilteredChat;
if (ImGui.Checkbox(Loc.Localize("LogFilteredMessages", "Log filtered messages"), ref logFilteredMessages)) {
if (ImGui.Checkbox(Language.LogFilteredMessages, ref logFilteredMessages)) {
this.Plugin.Config.LogFilteredChat = logFilteredMessages;
this.Plugin.Config.Save();
}
@ -80,7 +85,7 @@ namespace NoSoliciting.Interface {
ImGui.Separator();
if (ImGui.Button(Loc.Localize("ShowReportingWindow", "Show reporting window"))) {
if (ImGui.Button(Language.ShowReportingWindow)) {
this.Ui.Report.Open();
}
@ -96,18 +101,18 @@ namespace NoSoliciting.Interface {
this.DrawBasicMachineLearningConfig();
}
if (!ImGui.BeginTabItem(Loc.Localize("ModelTab", "Model"))) {
if (!ImGui.BeginTabItem(Language.ModelTab)) {
return;
}
ImGui.TextUnformatted(string.Format(Loc.Localize("ModelTabVersion", "Version: {0}"), this.Plugin.MlFilter?.Version));
ImGui.TextUnformatted(string.Format(Loc.Localize("ModelTabStatus", "Model status: {0}"), this.Plugin.MlStatus.Description()));
ImGui.TextUnformatted(string.Format(Language.ModelTabVersion, this.Plugin.MlFilter?.Version));
ImGui.TextUnformatted(string.Format(Language.ModelTabStatus, this.Plugin.MlStatus.Description()));
var lastError = MlFilter.LastError;
if (lastError != null) {
ImGui.TextUnformatted(string.Format(Loc.Localize("ModelTabError", "Last error: {0}"), lastError));
ImGui.TextUnformatted(string.Format(Language.ModelTabError, lastError));
}
if (ImGui.Button(Loc.Localize("UpdateModel", "Update model"))) {
if (ImGui.Button(Language.UpdateModel)) {
// prevent issues when people spam the button
if (ImGui.GetIO().KeyCtrl || this.Plugin.MlStatus is MlFilterStatus.Uninitialised or MlFilterStatus.Initialised) {
this.Plugin.MlFilter?.Dispose();
@ -121,7 +126,7 @@ namespace NoSoliciting.Interface {
}
private void DrawBasicMachineLearningConfig() {
if (!ImGui.BeginTabItem(Loc.Localize("FiltersTab", "Filters"))) {
if (!ImGui.BeginTabItem(Language.FiltersTab)) {
return;
}
@ -152,13 +157,13 @@ namespace NoSoliciting.Interface {
}
private void DrawAdvancedMachineLearningConfig() {
if (!ImGui.BeginTabItem(Loc.Localize("FiltersTab", "Filters"))) {
if (!ImGui.BeginTabItem(Language.FiltersTab)) {
return;
}
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(255f, 204f, 0f, 1f));
ImGui.TextUnformatted(Loc.Localize("AdvancedWarning1", "Do not change advanced settings unless you know what you are doing."));
ImGui.TextUnformatted(Loc.Localize("AdvancedWarning2", "The machine learning model was trained with certain channels in mind."));
ImGui.TextUnformatted(Language.AdvancedWarning1);
ImGui.TextUnformatted(Language.AdvancedWarning2);
ImGui.PopStyleColor();
foreach (var category in MessageCategoryExt.UiOrder) {
@ -204,13 +209,13 @@ namespace NoSoliciting.Interface {
#region Other config
private void DrawOtherFilters() {
if (!ImGui.BeginTabItem(Loc.Localize("OtherFiltersTab", "Other filters"))) {
if (!ImGui.BeginTabItem(Language.OtherFiltersTab)) {
return;
}
if (ImGui.CollapsingHeader(Loc.Localize("ChatFilters", "Chat filters"))) {
if (ImGui.CollapsingHeader(Language.ChatFilters)) {
var customChat = this.Plugin.Config.CustomChatFilter;
if (ImGui.Checkbox(Loc.Localize("EnableCustomChatFilters", "Enable custom chat filters"), ref customChat)) {
if (ImGui.Checkbox(Language.EnableCustomChatFilters, ref customChat)) {
this.Plugin.Config.CustomChatFilter = customChat;
this.Plugin.Config.Save();
}
@ -222,22 +227,22 @@ namespace NoSoliciting.Interface {
}
}
if (ImGui.CollapsingHeader(Loc.Localize("PartyFinderFilters", "Party Finder filters"))) {
if (ImGui.CollapsingHeader(Language.PartyFinderFilters)) {
var filterHugeItemLevelPFs = this.Plugin.Config.FilterHugeItemLevelPFs;
// ReSharper disable once InvertIf
if (ImGui.Checkbox(Loc.Localize("FilterIlvlPfs", "Filter PFs with item level above maximum"), ref filterHugeItemLevelPFs)) {
if (ImGui.Checkbox(Language.FilterIlvlPfs, ref filterHugeItemLevelPFs)) {
this.Plugin.Config.FilterHugeItemLevelPFs = filterHugeItemLevelPFs;
this.Plugin.Config.Save();
}
var considerPrivate = this.Plugin.Config.ConsiderPrivatePfs;
if (ImGui.Checkbox(Loc.Localize("FilterPrivatePfs", "Apply filters to private Party Finder listings"), ref considerPrivate)) {
if (ImGui.Checkbox(Language.FilterPrivatePfs, ref considerPrivate)) {
this.Plugin.Config.ConsiderPrivatePfs = considerPrivate;
this.Plugin.Config.Save();
}
var customPf = this.Plugin.Config.CustomPFFilter;
if (ImGui.Checkbox(Loc.Localize("EnableCustomPartyFinderFilters", "Enable custom Party Finder filters"), ref customPf)) {
if (ImGui.Checkbox(Language.EnableCustomPartyFinderFilters, ref customPf)) {
this.Plugin.Config.CustomPFFilter = customPf;
this.Plugin.Config.Save();
}
@ -255,7 +260,7 @@ namespace NoSoliciting.Interface {
private void DrawCustom(string name, ref List<string> substrings, ref List<string> regexes) {
ImGui.Columns(2);
ImGui.TextUnformatted(Loc.Localize("SubstringsToFilter", "Substrings to filter"));
ImGui.TextUnformatted(Language.SubstringsToFilter);
if (ImGui.BeginChild($"##{name}-substrings", new Vector2(0, 175))) {
for (var i = 0; i < substrings.Count; i++) {
var input = substrings[i];
@ -284,7 +289,7 @@ namespace NoSoliciting.Interface {
ImGui.NextColumn();
ImGui.TextUnformatted(Loc.Localize("RegularExpressionsToFilter", "Regular expressions to filter"));
ImGui.TextUnformatted(Language.RegularExpressionsToFilter);
if (ImGui.BeginChild($"##{name}-regexes", new Vector2(0, 175))) {
for (var i = 0; i < regexes.Count; i++) {
var input = regexes[i];
@ -320,7 +325,7 @@ namespace NoSoliciting.Interface {
ImGui.Columns(1);
// ReSharper disable once InvertIf
var saveLoc = Loc.Localize("SaveFilters", "Save filters");
var saveLoc = Language.SaveFilters;
if (ImGui.Button($"{saveLoc}##{name}-save")) {
this.Plugin.Config.Save();
this.Plugin.Config.CompileRegexes();

View File

@ -1,6 +1,5 @@
using System;
using CheapLoc;
using Dalamud;
using NoSoliciting.Resources;
namespace NoSoliciting.Ml {
public enum MessageCategory {
@ -75,30 +74,30 @@ namespace NoSoliciting.Ml {
#endif
public static string Name(this MessageCategory category) => category switch {
MessageCategory.Trade => Loc.Localize("TradeCategory", "Trade ads"),
MessageCategory.FreeCompany => Loc.Localize("FreeCompanyCategory", "Free Company ads"),
MessageCategory.Normal => Loc.Localize("NormalCategory", "Normal messages"),
MessageCategory.Phishing => Loc.Localize("PhishingCategory", "Phishing messages"),
MessageCategory.RmtContent => Loc.Localize("RmtContentCategory", "RMT (content)"),
MessageCategory.RmtGil => Loc.Localize("RmtGilCategory", "RMT (gil)"),
MessageCategory.Roleplaying => Loc.Localize("RoleplayingCategory", "Roleplaying ads"),
MessageCategory.Static => Loc.Localize("StaticCategory", "Static recruitment"),
MessageCategory.Community => Loc.Localize("CommunityCategory", "Community ads"),
MessageCategory.StaticSub => Loc.Localize("StaticSubCategory", "Static substitutes"),
MessageCategory.Trade => Language.TradeCategory,
MessageCategory.FreeCompany => Language.FreeCompanyCategory,
MessageCategory.Normal => Language.NormalCategory,
MessageCategory.Phishing => Language.PhishingCategory,
MessageCategory.RmtContent => Language.RmtContentCategory,
MessageCategory.RmtGil => Language.RmtGilCategory,
MessageCategory.Roleplaying => Language.RoleplayingCategory,
MessageCategory.Static => Language.StaticCategory,
MessageCategory.Community => Language.CommunityCategory,
MessageCategory.StaticSub => Language.StaticSubCategory,
_ => throw new ArgumentException("Invalid category", nameof(category)),
};
public static string Description(this MessageCategory category) => category switch {
MessageCategory.Trade => Loc.Localize("TradeDescription", "Messages advertising trading items or services for gil, such as omnicrafters looking for work or people selling rare items off the market board"),
MessageCategory.FreeCompany => Loc.Localize("FreeCompanyDescription", "Advertisements for Free Companies"),
MessageCategory.Normal => Loc.Localize("NormalDescription", "Normal messages that should not be filtered"),
MessageCategory.Phishing => Loc.Localize("PhishingDescription", "Messages trying to trick you into revealing your account details in order to steal your account"),
MessageCategory.RmtContent => Loc.Localize("RmtContentDescription", "Real-money trade involving content (also known as content sellers)"),
MessageCategory.RmtGil => Loc.Localize("RmtGilDescription", "Real-money trade involving gil or items (also known as RMT bots)"),
MessageCategory.Roleplaying => Loc.Localize("RoleplayingDescription", "Advertisements for personal RP, RP communities, venues, or anything else related to roleplaying"),
MessageCategory.Static => Loc.Localize("StaticDescription", "Statics looking for members or players looking for a static"),
MessageCategory.Community => Loc.Localize("CommunityDescription", "Advertisements for general-purpose communities, generally Discord servers"),
MessageCategory.StaticSub => Loc.Localize("StaticSubDescription", "Statics looking for fill-ins of missing members for clears"),
MessageCategory.Trade => Language.TradeDescription,
MessageCategory.FreeCompany => Language.FreeCompanyDescription,
MessageCategory.Normal => Language.NormalDescription,
MessageCategory.Phishing => Language.PhishingDescription,
MessageCategory.RmtContent => Language.RmtContentDescription,
MessageCategory.RmtGil => Language.RmtGilDescription,
MessageCategory.Roleplaying => Language.RoleplayingDescription,
MessageCategory.Static => Language.StaticDescription,
MessageCategory.Community => Language.CommunityDescription,
MessageCategory.StaticSub => Language.StaticSubDescription,
_ => throw new ArgumentException("Invalid category", nameof(category)),
};
}

View File

@ -9,10 +9,6 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="CheapLoc">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\CheapLoc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Dalamud">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
<Private>False</Private>
@ -42,19 +38,29 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="1.2.1"/>
<PackageReference Include="Fody" Version="6.5.1" PrivateAssets="all"/>
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.18.2"/>
<PackageReference Include="JKang.IpcServiceFramework.Client.NamedPipe" Version="3.1.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1"/>
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/>
<PackageReference Include="YamlDotNet" Version="11.1.1"/>
<PackageReference Include="DalamudPackager" Version="1.2.1" />
<PackageReference Include="Fody" Version="6.5.1" PrivateAssets="all" />
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.18.2" />
<PackageReference Include="JKang.IpcServiceFramework.Client.NamedPipe" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="YamlDotNet" Version="11.1.1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\NoSoliciting.MessageClassifier\bin\Release\net48\NoSoliciting.MessageClassifier.exe"/>
<EmbeddedResource Include="Resources\en.json"/>
<EmbeddedResource Include="..\NoSoliciting.MessageClassifier\bin\Release\net48\NoSoliciting.MessageClassifier.exe" />
<EmbeddedResource Update="Resources\Language.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Language.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NoSoliciting.Interface\NoSoliciting.Interface.csproj"/>
<ProjectReference Include="..\NoSoliciting.Interface\NoSoliciting.Interface.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Language.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>NoSoliciting.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@ -1,10 +1,10 @@
using Dalamud.Plugin;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using CheapLoc;
using NoSoliciting.Interface;
using NoSoliciting.Ml;
using Resourcer;
@ -44,20 +44,10 @@ namespace NoSoliciting {
this.Interface = pluginInterface;
Loc.Setup(Resource.AsString("Resources/en.json"), Assembly.GetAssembly(typeof(Plugin)));
this.Interface.OnLanguageChanged += code => {
try {
var data = Resource.AsStringUnChecked($"Resources/{code}.json");
if (data != null) {
Loc.Setup(data, Assembly.GetAssembly(typeof(Plugin)));
return;
}
} catch (Exception) {
// ignore
}
Util.PreLoadResourcesFromMainAssembly();
Loc.Setup(Resource.AsString("Resources/en.json"), Assembly.GetAssembly(typeof(Plugin)));
};
Resources.Language.Culture = new CultureInfo(this.Interface.UiLanguage);
this.Interface.OnLanguageChanged += OnLanguageUpdate;
this.Config = this.Interface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();
this.Config.Initialise(this.Interface);
@ -92,11 +82,16 @@ namespace NoSoliciting {
this.Commands.Dispose();
this.Ui.Dispose();
this.Common.Dispose();
this.Interface.OnLanguageChanged -= OnLanguageUpdate;
}
this._disposedValue = true;
}
private static void OnLanguageUpdate(string langCode) {
Resources.Language.Culture = new CultureInfo(langCode);
}
internal void InitialiseMachineLearning(bool showWindow) {
if (this.MlFilter != null) {
return;

711
NoSoliciting/Resources/Language.Designer.cs generated Executable file
View File

@ -0,0 +1,711 @@
//------------------------------------------------------------------------------
// <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 NoSoliciting.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", "4.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("NoSoliciting.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 Advanced mode.
/// </summary>
internal static string AdvancedMode {
get {
return ResourceManager.GetString("AdvancedMode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do not change advanced settings unless you know what you are doing..
/// </summary>
internal static string AdvancedWarning1 {
get {
return ResourceManager.GetString("AdvancedWarning1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The machine learning model was trained with certain channels in mind..
/// </summary>
internal static string AdvancedWarning2 {
get {
return ResourceManager.GetString("AdvancedWarning2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chat filters.
/// </summary>
internal static string ChatFilters {
get {
return ResourceManager.GetString("ChatFilters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Community ads.
/// </summary>
internal static string CommunityCategory {
get {
return ResourceManager.GetString("CommunityCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Advertisements for general-purpose communities, generally Discord servers.
/// </summary>
internal static string CommunityDescription {
get {
return ResourceManager.GetString("CommunityDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enable custom chat filters.
/// </summary>
internal static string EnableCustomChatFilters {
get {
return ResourceManager.GetString("EnableCustomChatFilters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enable custom Party Finder filters.
/// </summary>
internal static string EnableCustomPartyFinderFilters {
get {
return ResourceManager.GetString("EnableCustomPartyFinderFilters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Filter PFs with item level above maximum.
/// </summary>
internal static string FilterIlvlPfs {
get {
return ResourceManager.GetString("FilterIlvlPfs", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Apply filters to private Party Finder listings.
/// </summary>
internal static string FilterPrivatePfs {
get {
return ResourceManager.GetString("FilterPrivatePfs", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Filters.
/// </summary>
internal static string FiltersTab {
get {
return ResourceManager.GetString("FiltersTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Free Company ads.
/// </summary>
internal static string FreeCompanyCategory {
get {
return ResourceManager.GetString("FreeCompanyCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Advertisements for Free Companies.
/// </summary>
internal static string FreeCompanyDescription {
get {
return ResourceManager.GetString("FreeCompanyDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log filtered messages.
/// </summary>
internal static string LogFilteredMessages {
get {
return ResourceManager.GetString("LogFilteredMessages", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log filtered PFs.
/// </summary>
internal static string LogFilteredPfs {
get {
return ResourceManager.GetString("LogFilteredPfs", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Model.
/// </summary>
internal static string ModelTab {
get {
return ResourceManager.GetString("ModelTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last error: {0}.
/// </summary>
internal static string ModelTabError {
get {
return ResourceManager.GetString("ModelTabError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Model status: {0}.
/// </summary>
internal static string ModelTabStatus {
get {
return ResourceManager.GetString("ModelTabStatus", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Version: {0}.
/// </summary>
internal static string ModelTabVersion {
get {
return ResourceManager.GetString("ModelTabVersion", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Normal messages.
/// </summary>
internal static string NormalCategory {
get {
return ResourceManager.GetString("NormalCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Normal messages that should not be filtered.
/// </summary>
internal static string NormalDescription {
get {
return ResourceManager.GetString("NormalDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Other filters.
/// </summary>
internal static string OtherFiltersTab {
get {
return ResourceManager.GetString("OtherFiltersTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Other.
/// </summary>
internal static string OtherTab {
get {
return ResourceManager.GetString("OtherTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Party Finder filters.
/// </summary>
internal static string PartyFinderFilters {
get {
return ResourceManager.GetString("PartyFinderFilters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Phishing messages.
/// </summary>
internal static string PhishingCategory {
get {
return ResourceManager.GetString("PhishingCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Messages trying to trick you into revealing your account details in order to steal your account.
/// </summary>
internal static string PhishingDescription {
get {
return ResourceManager.GetString("PhishingDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Regular expressions to filter.
/// </summary>
internal static string RegularExpressionsToFilter {
get {
return ResourceManager.GetString("RegularExpressionsToFilter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chat.
/// </summary>
internal static string ReportChatTab {
get {
return ResourceManager.GetString("ReportChatTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Channel.
/// </summary>
internal static string ReportColumnChannel {
get {
return ResourceManager.GetString("ReportColumnChannel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Description.
/// </summary>
internal static string ReportColumnDescription {
get {
return ResourceManager.GetString("ReportColumnDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Host.
/// </summary>
internal static string ReportColumnHost {
get {
return ResourceManager.GetString("ReportColumnHost", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Message.
/// </summary>
internal static string ReportColumnMessage {
get {
return ResourceManager.GetString("ReportColumnMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reason.
/// </summary>
internal static string ReportColumnReason {
get {
return ResourceManager.GetString("ReportColumnReason", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sender.
/// </summary>
internal static string ReportColumnSender {
get {
return ResourceManager.GetString("ReportColumnSender", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Timestamp.
/// </summary>
internal static string ReportColumnTimestamp {
get {
return ResourceManager.GetString("ReportColumnTimestamp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Click on one of the entries below to report it to the developer as miscategorised..
/// </summary>
internal static string ReportHelp {
get {
return ResourceManager.GetString("ReportHelp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} reporting.
/// </summary>
internal static string Reporting {
get {
return ResourceManager.GetString("Reporting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
internal static string ReportModalCancel {
get {
return ResourceManager.GetString("ReportModalCancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy to clipboard.
/// </summary>
internal static string ReportModalCopy {
get {
return ResourceManager.GetString("ReportModalCopy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You cannot report messages filtered because of a custom filter..
/// </summary>
internal static string ReportModalCustom {
get {
return ResourceManager.GetString("ReportModalCustom", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reporting this message will let the developer know that you think this message was incorrectly classified..
/// </summary>
internal static string ReportModalHelp1 {
get {
return ResourceManager.GetString("ReportModalHelp1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to NoSoliciting only works for English messages. Do not report non-English messages..
/// </summary>
internal static string ReportModalHelp2 {
get {
return ResourceManager.GetString("ReportModalHelp2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Report.
/// </summary>
internal static string ReportModalReport {
get {
return ResourceManager.GetString("ReportModalReport", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Report to {0}.
/// </summary>
internal static string ReportModalTitle {
get {
return ResourceManager.GetString("ReportModalTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specifically, this message WAS filtered but shouldn&apos;t have been..
/// </summary>
internal static string ReportModalWasFiltered {
get {
return ResourceManager.GetString("ReportModalWasFiltered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specifically, this message WAS NOT filtered but should have been..
/// </summary>
internal static string ReportModalWasNotFiltered {
get {
return ResourceManager.GetString("ReportModalWasNotFiltered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Party Finder.
/// </summary>
internal static string ReportPartyFinderTab {
get {
return ResourceManager.GetString("ReportPartyFinderTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to failed to send.
/// </summary>
internal static string ReportStatusFailure {
get {
return ResourceManager.GetString("ReportStatusFailure", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to sending.
/// </summary>
internal static string ReportStatusInProgress {
get {
return ResourceManager.GetString("ReportStatusInProgress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last report status: {0}.
/// </summary>
internal static string ReportStatusMessage {
get {
return ResourceManager.GetString("ReportStatusMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to sent successfully.
/// </summary>
internal static string ReportStatusSuccessful {
get {
return ResourceManager.GetString("ReportStatusSuccessful", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to unknown.
/// </summary>
internal static string ReportStatusUnknown {
get {
return ResourceManager.GetString("ReportStatusUnknown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to report Party Finder listing hosted by {0}..
/// </summary>
internal static string ReportToastFailure {
get {
return ResourceManager.GetString("ReportToastFailure", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Party Finder listing hosted by {0} reported successfully..
/// </summary>
internal static string ReportToastSuccess {
get {
return ResourceManager.GetString("ReportToastSuccess", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Report to NoSoliciting.
/// </summary>
internal static string ReportToNoSoliciting {
get {
return ResourceManager.GetString("ReportToNoSoliciting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to RMT (content).
/// </summary>
internal static string RmtContentCategory {
get {
return ResourceManager.GetString("RmtContentCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Real-money trade involving content (also known as content sellers).
/// </summary>
internal static string RmtContentDescription {
get {
return ResourceManager.GetString("RmtContentDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to RMT (gil).
/// </summary>
internal static string RmtGilCategory {
get {
return ResourceManager.GetString("RmtGilCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Real-money trade involving gil or items (also known as RMT bots).
/// </summary>
internal static string RmtGilDescription {
get {
return ResourceManager.GetString("RmtGilDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Roleplaying ads.
/// </summary>
internal static string RoleplayingCategory {
get {
return ResourceManager.GetString("RoleplayingCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Advertisements for personal RP, RP communities, venues, or anything else related to roleplaying.
/// </summary>
internal static string RoleplayingDescription {
get {
return ResourceManager.GetString("RoleplayingDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save filters.
/// </summary>
internal static string SaveFilters {
get {
return ResourceManager.GetString("SaveFilters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} settings.
/// </summary>
internal static string Settings {
get {
return ResourceManager.GetString("Settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show reporting window.
/// </summary>
internal static string ShowReportingWindow {
get {
return ResourceManager.GetString("ShowReportingWindow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Static recruitment.
/// </summary>
internal static string StaticCategory {
get {
return ResourceManager.GetString("StaticCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Statics looking for members or players looking for a static.
/// </summary>
internal static string StaticDescription {
get {
return ResourceManager.GetString("StaticDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Static substitutes.
/// </summary>
internal static string StaticSubCategory {
get {
return ResourceManager.GetString("StaticSubCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Statics looking for fill-ins of missing members for clears.
/// </summary>
internal static string StaticSubDescription {
get {
return ResourceManager.GetString("StaticSubDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Substrings to filter.
/// </summary>
internal static string SubstringsToFilter {
get {
return ResourceManager.GetString("SubstringsToFilter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Trade ads.
/// </summary>
internal static string TradeCategory {
get {
return ResourceManager.GetString("TradeCategory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Messages advertising trading items or services for gil, such as omnicrafters looking for work or people selling rare items off the market board.
/// </summary>
internal static string TradeDescription {
get {
return ResourceManager.GetString("TradeDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Update model.
/// </summary>
internal static string UpdateModel {
get {
return ResourceManager.GetString("UpdateModel", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,17 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ReportToNoSoliciting" xml:space="preserve">
<value>An NoSoliciting melden</value>
</data>
</root>

View File

@ -0,0 +1,17 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ReportToNoSoliciting" xml:space="preserve">
<value>Signaler à NoSoliciting</value>
</data>
</root>

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="OtherTab" xml:space="preserve">
<value>Other</value>
</data>
<data name="LogFilteredPfs" xml:space="preserve">
<value>Log filtered PFs</value>
</data>
<data name="LogFilteredMessages" xml:space="preserve">
<value>Log filtered messages</value>
</data>
<data name="ShowReportingWindow" xml:space="preserve">
<value>Show reporting window</value>
</data>
<data name="Settings" xml:space="preserve">
<value>{0} settings</value>
</data>
<data name="AdvancedMode" xml:space="preserve">
<value>Advanced mode</value>
</data>
<data name="ModelTab" xml:space="preserve">
<value>Model</value>
</data>
<data name="ModelTabVersion" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="ModelTabStatus" xml:space="preserve">
<value>Model status: {0}</value>
</data>
<data name="ModelTabError" xml:space="preserve">
<value>Last error: {0}</value>
</data>
<data name="UpdateModel" xml:space="preserve">
<value>Update model</value>
</data>
<data name="FiltersTab" xml:space="preserve">
<value>Filters</value>
</data>
<data name="AdvancedWarning1" xml:space="preserve">
<value>Do not change advanced settings unless you know what you are doing.</value>
</data>
<data name="AdvancedWarning2" xml:space="preserve">
<value>The machine learning model was trained with certain channels in mind.</value>
</data>
<data name="OtherFiltersTab" xml:space="preserve">
<value>Other filters</value>
</data>
<data name="ChatFilters" xml:space="preserve">
<value>Chat filters</value>
</data>
<data name="EnableCustomChatFilters" xml:space="preserve">
<value>Enable custom chat filters</value>
</data>
<data name="PartyFinderFilters" xml:space="preserve">
<value>Party Finder filters</value>
</data>
<data name="FilterIlvlPfs" xml:space="preserve">
<value>Filter PFs with item level above maximum</value>
</data>
<data name="FilterPrivatePfs" xml:space="preserve">
<value>Apply filters to private Party Finder listings</value>
</data>
<data name="EnableCustomPartyFinderFilters" xml:space="preserve">
<value>Enable custom Party Finder filters</value>
</data>
<data name="SubstringsToFilter" xml:space="preserve">
<value>Substrings to filter</value>
</data>
<data name="RegularExpressionsToFilter" xml:space="preserve">
<value>Regular expressions to filter</value>
</data>
<data name="SaveFilters" xml:space="preserve">
<value>Save filters</value>
</data>
<data name="Reporting" xml:space="preserve">
<value>{0} reporting</value>
</data>
<data name="ReportHelp" xml:space="preserve">
<value>Click on one of the entries below to report it to the developer as miscategorised.</value>
</data>
<data name="ReportStatusFailure" xml:space="preserve">
<value>failed to send</value>
</data>
<data name="ReportStatusSuccessful" xml:space="preserve">
<value>sent successfully</value>
</data>
<data name="ReportStatusInProgress" xml:space="preserve">
<value>sending</value>
</data>
<data name="ReportStatusUnknown" xml:space="preserve">
<value>unknown</value>
</data>
<data name="ReportStatusMessage" xml:space="preserve">
<value>Last report status: {0}</value>
</data>
<data name="ReportChatTab" xml:space="preserve">
<value>Chat</value>
</data>
<data name="ReportColumnTimestamp" xml:space="preserve">
<value>Timestamp</value>
</data>
<data name="ReportColumnChannel" xml:space="preserve">
<value>Channel</value>
</data>
<data name="ReportColumnReason" xml:space="preserve">
<value>Reason</value>
</data>
<data name="ReportColumnSender" xml:space="preserve">
<value>Sender</value>
</data>
<data name="ReportColumnMessage" xml:space="preserve">
<value>Message</value>
</data>
<data name="ReportPartyFinderTab" xml:space="preserve">
<value>Party Finder</value>
</data>
<data name="ReportColumnHost" xml:space="preserve">
<value>Host</value>
</data>
<data name="ReportColumnDescription" xml:space="preserve">
<value>Description</value>
</data>
<data name="ReportModalTitle" xml:space="preserve">
<value>Report to {0}</value>
</data>
<data name="ReportModalHelp1" xml:space="preserve">
<value>Reporting this message will let the developer know that you think this message was incorrectly classified.</value>
</data>
<data name="ReportModalWasFiltered" xml:space="preserve">
<value>Specifically, this message WAS filtered but shouldn't have been.</value>
</data>
<data name="ReportModalWasNotFiltered" xml:space="preserve">
<value>Specifically, this message WAS NOT filtered but should have been.</value>
</data>
<data name="ReportModalHelp2" xml:space="preserve">
<value>NoSoliciting only works for English messages. Do not report non-English messages.</value>
</data>
<data name="ReportModalCustom" xml:space="preserve">
<value>You cannot report messages filtered because of a custom filter.</value>
</data>
<data name="ReportModalReport" xml:space="preserve">
<value>Report</value>
</data>
<data name="ReportModalCopy" xml:space="preserve">
<value>Copy to clipboard</value>
</data>
<data name="ReportModalCancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="TradeCategory" xml:space="preserve">
<value>Trade ads</value>
</data>
<data name="FreeCompanyCategory" xml:space="preserve">
<value>Free Company ads</value>
</data>
<data name="NormalCategory" xml:space="preserve">
<value>Normal messages</value>
</data>
<data name="PhishingCategory" xml:space="preserve">
<value>Phishing messages</value>
</data>
<data name="RmtContentCategory" xml:space="preserve">
<value>RMT (content)</value>
</data>
<data name="RmtGilCategory" xml:space="preserve">
<value>RMT (gil)</value>
</data>
<data name="RoleplayingCategory" xml:space="preserve">
<value>Roleplaying ads</value>
</data>
<data name="StaticCategory" xml:space="preserve">
<value>Static recruitment</value>
</data>
<data name="CommunityCategory" xml:space="preserve">
<value>Community ads</value>
</data>
<data name="StaticSubCategory" xml:space="preserve">
<value>Static substitutes</value>
</data>
<data name="TradeDescription" xml:space="preserve">
<value>Messages advertising trading items or services for gil, such as omnicrafters looking for work or people selling rare items off the market board</value>
</data>
<data name="FreeCompanyDescription" xml:space="preserve">
<value>Advertisements for Free Companies</value>
</data>
<data name="NormalDescription" xml:space="preserve">
<value>Normal messages that should not be filtered</value>
</data>
<data name="PhishingDescription" xml:space="preserve">
<value>Messages trying to trick you into revealing your account details in order to steal your account</value>
</data>
<data name="RmtContentDescription" xml:space="preserve">
<value>Real-money trade involving content (also known as content sellers)</value>
</data>
<data name="RmtGilDescription" xml:space="preserve">
<value>Real-money trade involving gil or items (also known as RMT bots)</value>
</data>
<data name="RoleplayingDescription" xml:space="preserve">
<value>Advertisements for personal RP, RP communities, venues, or anything else related to roleplaying</value>
</data>
<data name="StaticDescription" xml:space="preserve">
<value>Statics looking for members or players looking for a static</value>
</data>
<data name="CommunityDescription" xml:space="preserve">
<value>Advertisements for general-purpose communities, generally Discord servers</value>
</data>
<data name="StaticSubDescription" xml:space="preserve">
<value>Statics looking for fill-ins of missing members for clears</value>
</data>
<data name="ReportToNoSoliciting" xml:space="preserve">
<value>Report to NoSoliciting</value>
</data>
<data name="ReportToastSuccess" xml:space="preserve">
<value>Party Finder listing hosted by {0} reported successfully.</value>
</data>
<data name="ReportToastFailure" xml:space="preserve">
<value>Failed to report Party Finder listing hosted by {0}.</value>
</data>
</root>

View File

@ -1,290 +0,0 @@
{
"ReportToNoSoliciting": {
"message": "Report to NoSoliciting",
"description": "The context menu item shown for reporting in the Party Finder"
},
"ReportToastSuccess": {
"message": "Party Finder listing hosted by {0} reported successfully.",
"description": "The toast shown on a successful report. {0} is replaced by a player's name"
},
"ReportToastFailure": {
"message": "Failed to report Party Finder listing hosted by {0}.",
"description": "The toast shown on a failed report. {0} is replaced by a player's name"
},
"TradeCategory": {
"message": "Trade ads",
"description": "A machine learning category name"
},
"FreeCompanyCategory": {
"message": "Free Company ads",
"description": "A machine learning category name"
},
"NormalCategory": {
"message": "Normal messages",
"description": "A machine learning category name"
},
"PhishingCategory": {
"message": "Phishing messages",
"description": "A machine learning category name"
},
"RmtContentCategory": {
"message": "RMT (content)",
"description": "A machine learning category name"
},
"RmtGilCategory": {
"message": "RMT (gil)",
"description": "A machine learning category name"
},
"RoleplayingCategory": {
"message": "Roleplaying ads",
"description": "A machine learning category name"
},
"StaticCategory": {
"message": "Static recruitment",
"description": "A machine learning category name"
},
"CommunityCategory": {
"message": "Community ads",
"description": "A machine learning category name"
},
"StaticSubCategory": {
"message": "Static substitutes",
"description": "A machine learning category name"
},
"TradeDescription": {
"message": "Messages advertising trading items or services for gil, such as omnicrafters looking for work or people selling rare items off the market board",
"description": "A machine learning category description"
},
"FreeCompanyDescription": {
"message": "Advertisements for Free Companies",
"description": "A machine learning category description"
},
"NormalDescription": {
"message": "Normal messages that should not be filtered",
"description": "A machine learning category description"
},
"PhishingDescription": {
"message": "Messages trying to trick you into revealing your account details in order to steal your account",
"description": "A machine learning category description"
},
"RmtContentDescription": {
"message": "Real-money trade involving content (also known as content sellers)",
"description": "A machine learning category description"
},
"RmtGilDescription": {
"message": "Real-money trade involving gil or items (also known as RMT bots)",
"description": "A machine learning category description"
},
"RoleplayingDescription": {
"message": "Advertisements for personal RP, RP communities, venues, or anything else related to roleplaying",
"description": "A machine learning category description"
},
"StaticDescription": {
"message": "Statics looking for members or players looking for a static",
"description": "A machine learning category description"
},
"CommunityDescription": {
"message": "Advertisements for general-purpose communities, generally Discord servers",
"description": "A machine learning category description"
},
"StaticSubDescription": {
"message": "Statics looking for fill-ins of missing members for clears",
"description": "A machine learning category description"
},
"Reporting": {
"message": "{0} reporting",
"description": "The title of the reporting window. {0} is replaced with the plugin name"
},
"ReportHelp": {
"message": "Click on one of the entries below to report it to the developer as miscategorised.",
"description": "A help message shown at the top of the reporting window"
},
"ReportStatusFailure": {
"message": "failed to send",
"description": "The status to be shown in ReportStatusMessage for failed reports"
},
"ReportStatusSuccessful": {
"message": "sent successfully",
"description": "The status to be shown in ReportStatusMessage for successful reports"
},
"ReportStatusInProgress": {
"message": "sending",
"description": "The status to be shown in ReportStatusMessage for in-progress reports"
},
"ReportStatusUnknown": {
"message": "unknown",
"description": "The status to be shown in ReportStatusMessage for reports with an unknown status"
},
"ReportStatusMessage": {
"message": "Last report status: {0}",
"description": "Shown on the reporting window to indicate the status of the last report"
},
"ReportChatTab": {
"message": "Chat",
"description": "The tab in the reporting window for chat messages"
},
"ReportColumnTimestamp": {
"message": "Timestamp",
"description": "The column in the reporting window for timestamps"
},
"ReportColumnChannel": {
"message": "Channel",
"description": "The column in the reporting window for chat channels"
},
"ReportColumnReason": {
"message": "Reason",
"description": "The column in the reporting window for filter reasons"
},
"ReportColumnSender": {
"message": "Sender",
"description": "The column in the reporting window for senders"
},
"ReportColumnMessage": {
"message": "Message",
"description": "The column in the reporting window for chat messages"
},
"ReportPartyFinderTab": {
"message": "Party Finder",
"description": "The tab in the reporting window for Party Finder listings"
},
"ReportColumnHost": {
"message": "Host",
"description": "The column in the reporting window for Party Finder hosts"
},
"ReportColumnDescription": {
"message": "Description",
"description": "The column in the reporting window for Party Finder descriptions"
},
"ReportModalTitle": {
"message": "Report to {0}",
"description": "The window title for the reporting window. The {0} is replaced with the plugin name"
},
"ReportModalHelp1": {
"message": "Reporting this message will let the developer know that you think this message was incorrectly classified.",
"description": "Help text shown when attempting to report a message"
},
"ReportModalWasNotFiltered": {
"message": "Specifically, this message WAS NOT filtered but should have been.",
"description": "Help text shown when attempting to report a false negative"
},
"ReportModalWasFiltered": {
"message": "Specifically, this message WAS filtered but shouldn't have been.",
"description": "Help text shown when attempting to report a false positive"
},
"ReportModalHelp2": {
"message": "NoSoliciting only works for English messages. Do not report non-English messages.",
"description": "Help text shown when attempting to report a message"
},
"ReportModalCustom": {
"message": "You cannot report messages filtered because of a custom filter.",
"description": "Error text shown when attempting to report a message filtered by a custom filter"
},
"ReportModalReport": {
"message": "Report",
"description": "The button used to report a message"
},
"ReportModalCopy": {
"message": "Copy to clipboard",
"description": "The button used to copy a message to the clipboard"
},
"ReportModalCancel": {
"message": "Cancel",
"description": "The button used to cancel reporting a message"
},
"Settings": {
"message": "{0} settings",
"description": "The title of the settings window. The {0} is replaced with the plugin name"
},
"AdvancedMode": {
"message": "Advanced mode",
"description": "A checkbox used to enable advanced options"
},
"OtherTab": {
"message": "Other",
"description": "The tab used for other settings"
},
"LogFilteredPfs": {
"message": "Log filtered PFs",
"description": "A checkbox used to enable PF filter logs"
},
"LogFilteredMessages": {
"message": "Log filtered messages",
"description": "A checkbox used to enable chat filter logs"
},
"ShowReportingWindow": {
"message": "Show reporting window",
"description": "A button used to show the reporting window"
},
"ModelTab": {
"message": "Model",
"description": "The settings tab for machine learning model settings"
},
"ModelTabVersion": {
"message": "Version: {0}",
"description": "The version of the machine learning model. The {0} is replaced with the actual version"
},
"ModelTabStatus": {
"message": "Model status: {0}",
"description": "The status of the machine learning model. The {0} is replaced with the actual status"
},
"ModelTabError": {
"message": "Last error: {0}",
"description": "The last error encountered when loading the machine learning model. The {0} is replaced with the actual error"
},
"UpdateModel": {
"message": "Update model",
"description": "A button used to update the machine learning model"
},
"FiltersTab": {
"message": "Filters",
"description": "The settings tab for configuring filters"
},
"AdvancedWarning1": {
"message": "Do not change advanced settings unless you know what you are doing.",
"description": "Help text shown in the filters tab"
},
"AdvancedWarning2": {
"message": "The machine learning model was trained with certain channels in mind.",
"description": "Help text shown in the filters tab"
},
"OtherFiltersTab": {
"message": "Other filters",
"description": "The settings tab for other filters"
},
"ChatFilters": {
"message": "Chat filters",
"description": "The section header for other chat filters"
},
"EnableCustomChatFilters": {
"message": "Enable custom chat filters",
"description": "A checkbox used to enable custom chat filters"
},
"PartyFinderFilters": {
"message": "Party Finder filters",
"description": "The section header for other Party Finder filters"
},
"FilterIlvlPfs": {
"message": "Filter PFs with item level above maximum",
"description": "A checkbox used to enable filtering Party Finders with item levels above maximum"
},
"FilterPrivatePfs": {
"message": "Apply filters to private Party Finder listings",
"description": "A checkbox used to enable filtering private Party Finder listings"
},
"EnableCustomPartyFinderFilters": {
"message": "Enable custom Party Finder filters",
"description": "A checkbox used to enable custom Party Finder filters"
},
"SubstringsToFilter": {
"message": "Substrings to filter",
"description": "A column of text boxes containing substrings to filter"
},
"RegularExpressionsToFilter": {
"message": "Regular expressions to filter",
"description": "A column of text boxes containing regular expressions to filter"
},
"SaveFilters": {
"message": "Save filters",
"description": "A button used to save custom filters after editing"
}
}

50
NoSoliciting/Util.cs Executable file
View File

@ -0,0 +1,50 @@
using System;
using System.Collections;
using System.Globalization;
using System.Reflection;
namespace NoSoliciting {
internal static class Util {
internal static void PreLoadResourcesFromMainAssembly() {
const string resourcesPrefix = "NoSoliciting.Resources.Language.";
const string resourcesExtension = ".resources";
// get loaded resource sets from resource manager
var resourceManager = Resources.Language.ResourceManager;
if ((
resourceManager.GetType().GetField("_resourceSets", BindingFlags.Instance | BindingFlags.NonPublic) ??
// ReSharper disable once PossibleNullReferenceException
resourceManager.GetType().GetField("ResourceSets", BindingFlags.Instance | BindingFlags.NonPublic)
).GetValue(resourceManager) is not IDictionary resourceSetByCulture) {
return;
}
var resourceAssembly = typeof(Plugin).Assembly; // get assembly with localization resources
foreach (var embeddedResourceName in resourceAssembly.GetManifestResourceNames()) {
if (embeddedResourceName.StartsWith(resourcesPrefix, StringComparison.Ordinal) == false ||
embeddedResourceName.EndsWith(resourcesExtension, StringComparison.Ordinal) == false) {
continue; // not localized resource
}
var locale = embeddedResourceName.Substring(resourcesPrefix.Length, Math.Max(0, embeddedResourceName.Length - resourcesPrefix.Length - resourcesExtension.Length));
if (string.IsNullOrEmpty(locale)) {
continue; // default locale
}
var resourceStream = resourceAssembly.GetManifestResourceStream(embeddedResourceName);
if (resourceStream == null) {
continue; // no resource stream
}
var resourceSet = new System.Resources.ResourceSet(resourceStream);
var culture = CultureInfo.GetCultureInfo(locale);
if (resourceSetByCulture is Hashtable) {
resourceSetByCulture.Add(culture, resourceSet);
} else {
resourceSetByCulture.Add(culture.Name, resourceSet);
}
}
}
}
}