Skip to content

Commit 4c30faa

Browse files
committed
Fix translation reading from configuration
1 parent fbf7101 commit 4c30faa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

OpenDeathMessages/Commands/CommandDeathMessageDisplay.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using EvolutionPlugins.OpenDeathMessages.API;
33
using EvolutionPlugins.OpenDeathMessages.Services;
44
using Microsoft.Extensions.Configuration;
5+
using Microsoft.Extensions.Localization;
56
using OpenMod.Core.Commands;
67
using OpenMod.Unturned.Commands;
78
using OpenMod.Unturned.Users;
@@ -17,11 +18,14 @@ public class CommandDeathMessageDisplay : UnturnedCommand
1718
{
1819
private readonly IPlayerMessager m_PlayerMessager;
1920
private readonly IConfiguration m_Configuration;
21+
private readonly IStringLocalizer m_StringLocalizer;
2022

21-
public CommandDeathMessageDisplay(IServiceProvider serviceProvider, IPlayerMessager playerMessager, IConfiguration configuration) : base(serviceProvider)
23+
public CommandDeathMessageDisplay(IServiceProvider serviceProvider, IPlayerMessager playerMessager, IConfiguration configuration,
24+
IStringLocalizer stringLocalizer) : base(serviceProvider)
2225
{
2326
m_PlayerMessager = playerMessager;
2427
m_Configuration = configuration;
28+
m_StringLocalizer = stringLocalizer;
2529
}
2630

2731
protected override async UniTask OnExecuteAsync()
@@ -50,7 +54,7 @@ protected override async UniTask OnExecuteAsync()
5054
var user = (UnturnedUser)Context.Actor;
5155
await m_PlayerMessager.ChangeDisplayTypeAsync(user.Player, displayType);
5256

53-
await PrintAsync(m_Configuration[$"commands:deathMessageDisplay:{(displayType is DisplayType.Global ? "global" : "group")}"]);
57+
await PrintAsync(m_StringLocalizer[$"commands:deathMessageDisplay:{(displayType is DisplayType.Global ? "global" : "group")}"]);
5458
}
5559
}
5660
}

0 commit comments

Comments
 (0)