feat: Add display culture config

This commit is contained in:
2025-04-08 10:00:28 +08:00
parent b60e62af70
commit ef5cf78a03
3 changed files with 10 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ namespace Cryville.EEW.Unity {
bool DoDisplayTimeZone,
bool DoSwitchBackToHistory,
string OverrideDisplayCulture,
IReadOnlyCollection<EventSourceConfig> EventSources
) {
public static Config Default => new(
@@ -25,6 +27,8 @@ namespace Cryville.EEW.Unity {
true,
true,
"",
new List<EventSourceConfig> {
new JMAAtomEventSourceConfig(Array.Empty<string>()),
new UpdateCheckerEventSourceConfig(),

View File

@@ -1,4 +1,5 @@
using Cryville.EEW.Colors;
using Cryville.EEW.Core;
using Cryville.EEW.Core.Colors;
using Cryville.EEW.FERegion;
using Cryville.EEW.Map;
@@ -27,6 +28,7 @@ namespace Cryville.EEW.Unity {
public ISubColorScheme TextColorScheme { get; private set; } = new DefaultTextColorScheme(Color.White, Color.Black);
public TimeSpan NowcastWarningDelayTolerance => TimeSpan.FromMinutes(60); // TODO TTS
public CultureInfo RVMCulture { get; private set; } = SharedCultures.CurrentUICulture;
readonly int _infoLocationSpecificity = 3;
readonly int _ttsLocationSpecificity = 3;
readonly LocationNamer _locationNamer = new() { Namer = new FERegionLongNamer() }; // TODO TTS
@@ -115,6 +117,9 @@ namespace Cryville.EEW.Unity {
OverrideTimeZone = ParseTimeZone(config.OverrideTimeZone);
DoDisplayTimeZone = config.DoDisplayTimeZone;
DoSwitchBackToHistory = config.DoSwitchBackToHistory;
RVMCulture = config.OverrideDisplayCulture is string rvmCulture
? (string.IsNullOrEmpty(rvmCulture) ? SharedCultures.CurrentUICulture : SharedCultures.Get(rvmCulture))
: CultureInfo.InvariantCulture;
EventSources = config.EventSources;
}

View File

@@ -64,6 +64,7 @@ namespace Cryville.EEW.Unity {
BuildWorkers();
_worker.RVMGeneratorContext = SharedSettings.Instance;
_worker.TTSMessageGeneratorContext = SharedSettings.Instance;
_worker.RVMCulture = SharedSettings.Instance.RVMCulture;
_ongoingReportManager.Changed += OnOngoingReported;
_worker.Reported += OnReported;
_grouper.GroupUpdated += OnGroupUpdated;