using Content.Server.Speech.Components;
using System.Text.RegularExpressions;
namespace Content.Server.Speech.EntitySystems;
///
/// System that gives the speaker a faux-French accent.
///
public sealed class FrenchAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnAccentGet);
}
public string Accentuate(string message, FrenchAccentComponent component)
{
var msg = message;
msg = _replacement.ApplyReplacements(msg, "french");
// replaces th with dz
msg = Regex.Replace(msg, @"th", "'z", RegexOptions.IgnoreCase);
// removes the letter h from the start of words.
msg = Regex.Replace(msg, @"(?