@using Microsoft.AspNetCore.Components.Rendering
@using Moonlight.App.Services

@inject SmartTranslateService SmartTranslateService

@{
    var x = "";
    
    if (ChildContent != null)
    {
        var rb = new RenderTreeBuilder();
        ChildContent.Invoke(rb);

        foreach (var frame in rb.GetFrames().Array)
        {
            if (frame.Sequence != 0)
                x += frame.MarkupContent;
        }

        x = SmartTranslateService.Translate(x);
    }
}

<span>@(x)</span>

@code 
{
    [Parameter]
    public RenderFragment? ChildContent { get; set; }
}