Globalisation Changes

This commit is contained in:
Brett Hewitson 2021-12-02 17:23:26 +10:00
parent 4a80b089b4
commit 034d7401d1
15 changed files with 410 additions and 51 deletions

View file

@ -1,4 +1,5 @@
using ServerManagerTool.Plugin.Common.Delegates;
using ServerManagerTool.Plugin.Common.Events;
using ServerManagerTool.Plugin.Common.Lib;
using System;
using System.Collections.Generic;
@ -15,6 +16,7 @@ namespace ServerManagerTool.Plugin.Common
{
private const string PLUGINFILE_FOLDER = "Plugins";
private const string PLUGINFILE_EXTENSION = "dll";
public const string LANGUAGECODE_FALLBACK = "en-US";
private static volatile PluginHelper _instance;
private static readonly object _syncLock = new object();
@ -24,9 +26,12 @@ namespace ServerManagerTool.Plugin.Common
private FetchProfilesDelegate _fetchProfilesCallback;
private bool _disposed;
public EventHandler<ResourceDictionaryChangedEventArgs> ResourceDictionaryChanged;
private PluginHelper()
{
BetaEnabled = false;
LanguageCode = LANGUAGECODE_FALLBACK;
Plugins = new ObservableCollection<PluginItem>();
}
@ -61,6 +66,12 @@ namespace ServerManagerTool.Plugin.Common
set;
}
public string LanguageCode
{
get;
set;
}
public ObservableCollection<PluginItem> Plugins
{
get;
@ -236,6 +247,12 @@ namespace ServerManagerTool.Plugin.Common
}
}
public void OnResourceDictionaryChanged(string languageCode)
{
LanguageCode = languageCode;
ResourceDictionaryChanged?.Invoke(this, new ResourceDictionaryChangedEventArgs(languageCode));
}
internal void OpenConfigForm(string pluginCode, Window owner)
{
if (Plugins == null)