Skip to content

Commit

Permalink
Fix translation reading from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DiFFoZ committed Oct 27, 2022
1 parent fbf7101 commit 4c30faa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions OpenDeathMessages/Commands/CommandDeathMessageDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using EvolutionPlugins.OpenDeathMessages.API;
using EvolutionPlugins.OpenDeathMessages.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization;
using OpenMod.Core.Commands;
using OpenMod.Unturned.Commands;
using OpenMod.Unturned.Users;
Expand All @@ -17,11 +18,14 @@ public class CommandDeathMessageDisplay : UnturnedCommand
{
private readonly IPlayerMessager m_PlayerMessager;
private readonly IConfiguration m_Configuration;
private readonly IStringLocalizer m_StringLocalizer;

public CommandDeathMessageDisplay(IServiceProvider serviceProvider, IPlayerMessager playerMessager, IConfiguration configuration) : base(serviceProvider)
public CommandDeathMessageDisplay(IServiceProvider serviceProvider, IPlayerMessager playerMessager, IConfiguration configuration,
IStringLocalizer stringLocalizer) : base(serviceProvider)
{
m_PlayerMessager = playerMessager;
m_Configuration = configuration;
m_StringLocalizer = stringLocalizer;
}

protected override async UniTask OnExecuteAsync()
Expand Down Expand Up @@ -50,7 +54,7 @@ protected override async UniTask OnExecuteAsync()
var user = (UnturnedUser)Context.Actor;
await m_PlayerMessager.ChangeDisplayTypeAsync(user.Player, displayType);

await PrintAsync(m_Configuration[$"commands:deathMessageDisplay:{(displayType is DisplayType.Global ? "global" : "group")}"]);
await PrintAsync(m_StringLocalizer[$"commands:deathMessageDisplay:{(displayType is DisplayType.Global ? "global" : "group")}"]);
}
}
}

0 comments on commit 4c30faa

Please sign in to comment.