Translating dropdown list content in a selection block (optimizely forms)

Vote:
 

Hi,

Our client has asked us if we could translate the dropdown content within a selection block. 

however i have not been succesful. The new Culture Specific selection block is available to select from in the form container, however when i attempt to translate the content it doesnt seem to override the option field i have create below. Does anyone know what the cause might be for this?

Selection Element

[ContentType(DisplayName = "Culture Specific SelectionBlock",
        GUID = "02c28355-1f97-4090-b367-15b68186e816",
        Description = "Use when you need to options in another language",
        GroupName = "Custom Elements")]
    public class SelectionElement : SelectionElementBlock
    {
        [DisplayName("Culture Specific Options")]
        [Display(Order = 10)]
        [CultureSpecific]
        public override IEnumerable<OptionItem> Items { get; set; }

    }

Selection Element.cshtml

@using EPiServer.Forms.Helpers.Internal
@using EPiServer.Forms.UI.SelectionFactory
@using EPiServer.Shell.Web.Mvc.Html
@model Weir.Global.CMS.Core.DomainModels.Blocks.Forms.Elements.SelectionElement;

@{
    var formElement = Model.FormElement;
    var labelText = Model.Label;
    var placeholderText = Model.PlaceHolder;
    var defaultOptionSelected = !Model.AllowMultiSelect && !Model.Items.Any(x => x.Checked.HasValue && x.Checked.Value) ? "selected=\"selected\"" : "";
    var items = @Model.GetItems();
    var defaultValue = Model.GetDefaultValue();
    var cssClasses = Model.GetValidationCssClasses();
    var autoComplete = AutoCompleteSelectionFactory.GetStringValue(Model.AutoComplete);
}

@using (Html.BeginElement(Model, new { @class = "FormSelection" + Model.GetValidationCssClasses(), data_f_type = "selection" }))
{
    <label for="@formElement.Guid" class="Form__Element__Caption">@labelText</label>
    <select name="@formElement.ElementName" id="@formElement.Guid" @(Model.AllowMultiSelect ? "multiple" : "") @Html.Raw(Model.AttributesString) data-f-datainput

            aria-describedby="@Util.GetAriaDescribedByElementName(formElement.ElementName)"
            aria-invalid="@Util.GetAriaInvalidByValidationCssClasses(cssClasses)"
            autocomplete="@autoComplete">

        <!option disabled="disabled" @defaultOptionSelected value="">
            @(!string.IsNullOrWhiteSpace(placeholderText) ? placeholderText
                : Html.Translate(string.Format("/episerver/forms/viewmode/selection/{0}", Model.AllowMultiSelect ? "selectoptions" : "selectanoption")))
        </!option>
        @foreach (var item in items)
        {
            var defaultSelectedString = Model.GetDefaultSelectedString(item, defaultValue);
            var selectedString = string.IsNullOrEmpty(defaultSelectedString) ? string.Empty : "selected";

            <!option value="@item.Value" @selectedString @defaultSelectedString data-f-datainput>@item.Caption</!option>
        }
    </select>

    @Html.ValidationMessageFor(Model)
}

SelectionComponent:

 public class SelectionComponent : AsyncBlockComponent<SelectionElement>
    {
        private const string ElementViewPath = "/Views/Shared/Components/Forms/FormElements/SelectionElement.cshtml";
        protected override async Task<IViewComponentResult> InvokeComponentAsync(SelectionElement currentContent)
        {
            return await Task.FromResult(View(ElementViewPath, currentContent));
        }
    }

Does anyone know what i may be doing wrong here?

Thanks

#311931
Edited, Nov 03, 2023 14:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.