Search results

Globalization

Localization

Localization library allows you to localize the default text content of the In-place Editor to different cultures using the Locale property. In-place Editor following keys will be localize based on culture.

Locale key en-US (default)
save Close
cancel Cancel
editIcon Click to edit
editAreaClick Click to edit
editAreaDoubleClick Double click to edit

To load translation object in an application, define the culture and the component locale text corresponding to the language in a separate locale.json file under wwwroot folder.

{
    "fr-BE": {
        "inplace-editor": {
            "save": "enregistrer",
            "cancel": "Annuler",
            "editIcon": "Cliquez pour éditer",
            "editAreaClick": "Cliquez pour éditer",
            "editAreaDoubleClick": "Double-cliquez pour éditer"
        }
    }
}

In the following sample, French culture is set to In-place Editor and change the tooltip text.

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Inputs
@using Syncfusion.EJ2.Blazor.InPlaceEditor
@using Syncfusion.EJ2.Blazor.DropDowns
@using Microsoft.JSInterop;

<table class="table-section">
    <tr>
        <td> Choose Editable Type: </td>
        <td>
            <EjsDropDownList Value="DropdownValue" Width="auto" Placeholder="Select edit type" DataSource="EditableData">
                <DropDownListEvents ValueChange="Onchange" TValue="string"></DropDownListEvents>
            </EjsDropDownList>
        </td>
    </tr>
    <tr>
        <td class="sample-td">Enter your name: </td>
        <td class="sample-td">
            <EjsInPlaceEditor EditableOn="EditableOn" Mode="RenderMode.Inline" Type="InputType.Text" Value="TextValue" SubmitOnEnter="true" Locale="fr-BE" Model="TModel">
            </EjsInPlaceEditor>
        </td>
    </tr>
</table>

<style>
    .table-section {
        margin: 0 auto;
    }

    tr td:first-child {
        text-align: right;
        padding-right: 20px;
    }

    .sample-td {
        padding-top: 10px;
        min-width: 230px;
        height: 100px;
    }
</style>

@code {
    [Inject]
    protected IJSRuntime JsRuntime { get; set; }

    public string TextValue = "Andrew";
    public string DropdownValue = "Click";
    public string[] EditableData = new string[] { "Click", "DblClick", "EditIconClick" };
    public EditableType EditableOn = EditableType.Click;

    public TextBoxModel TModel = new TextBoxModel()
    {
        Placeholder = "Enter some text"
    };

    private void Onchange(ChangeEventArgs<string> args)
    {
        if (args.Value.ToString() == "Click")
        {
            this.EditableOn = EditableType.Click;
        }
        else if (args.Value.ToString() == "DblClick")
        {
            this.EditableOn = EditableType.DblClick;
        }
        else
        {
            this.EditableOn = EditableType.EditIconClick;
        }
        this.StateHasChanged();
    }

    protected override void OnAfterRender(bool firstRender) {
        //Refer the path for the locale data
        this.JsRuntime.Ejs().LoadLocaleData("wwroot/js/locale.json");
    }
}

The output will be as follows.

localization

Right to left

Specifies the direction of the In-place Editor component using the enableRtl property. For writing systems that requires Arabic, Hebrew, and more. The direction can be switched to right-to-left.

It will not change based on the locale property.

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Inputs
@using Syncfusion.EJ2.Blazor.InPlaceEditor

<table>
    <tr>
        <td class="col-lg-6 col-md-6 col-sm-6 col-xs-6 control-title content-title"> Enter your name: </td>
        <td class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
            <EjsInPlaceEditor EnableRtl="true" Mode="RenderMode.Inline" Type="InputType.Text" Value="@TextValue" SubmitOnEnter="true" Model="@TModel">
            </EjsInPlaceEditor>
        </td>
    </tr>
</table>

@code {
    public string TextValue = "Andrew";

    public TextBoxModel TModel = new TextBoxModel()
    {
        Placeholder = "Enter some text"
    };
}

The output will be as follows.

default

Format

Formatting is a way of representing the value in different formats. You can format the following mentioned components with its format property when it is passed through the In-place Editor Model property.

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Calendars
@using Syncfusion.EJ2.Blazor.InPlaceEditor

<table>
    <tr>
        <td class="col-lg-6 col-md-6 col-sm-6 col-xs-6 control-title"> DatePicker </td>
        <td class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
            <EjsInPlaceEditor Mode="RenderMode.Inline" Type="InputType.Date" Value="@DateValue" Model="@DateModel">
            </EjsInPlaceEditor>
        </td>
    </tr>
</table>

@code {
    public DateTime DateValue { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

    public DatePickerModel DateModel = new DatePickerModel()
    {
        Placeholder = "Select date",
        Format = "yyyy-MM-dd"
    };
}

The output will be as follows.

format