Localization

4 Apr 20222 minutes to read

Localization library allows to localize the default text content of Dialog. In Dialog, the close button’s tooltip text alone will be localized based on the culture.

Locale key en-US (default)
close close

Loading translations

To load translation object in an application, use load function of L10n class.

In the below sample, French culture is set to Dialog and change the close button’s tooltip text.

<div id='container' style="height:400px;">
    <ejs-button id="targetButton" content="Ouvrir le dialogue"></ejs-button>
    <ejs-dialog id="dialog" locale="fr-BE" showCloseIcon="true" header="Dialogue" content="Dialogue avec la culture française" target="#container" width="250px"></ejs-dialog>
</div>

<script>
    window.onload = function () {
        document.getElementById('targetButton').onclick = function () {
            var dialog = document.getElementById("dialog").ej2_instances[0];
            dialog.show();
        }
        ej.base.L10n.load({
            'fr-BE': {
                'dialog': { 'close': "Fermer" }
            }
        });
    }
</script>
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}

dialog