mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* sloth is so going to kill me * the voices in my head told me to do this * Register ILocalizationManagerInternal on client * Avoid breaking change * Cleanup * Release notes
34 lines
815 B
C#
34 lines
815 B
C#
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Client.Localization;
|
|
|
|
internal sealed class ClientLocalizationManager : LocalizationManager, ILocalizationManagerInternal
|
|
{
|
|
[Dependency] private readonly IReloadManager _reload = default!;
|
|
|
|
void ILocalizationManager.Initialize() => Initialize();
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_reload.Register(LocaleDirPath, "*.ftl");
|
|
|
|
_reload.OnChanged += OnReload;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handles Fluent hot reloading via LocalizationManager.ReloadLocalizations()
|
|
/// </summary>
|
|
private void OnReload(ResPath args)
|
|
{
|
|
if (args.Extension != "ftl")
|
|
return;
|
|
|
|
ReloadLocalizations();
|
|
}
|
|
}
|