Search results

Localization in ASP.NET Core Maps control

04 Aug 2021 / 1 minute to read

Localization library allows you to localize the default text content of maps. Maps has the static text for some features such as zooming toolbars and the text can be changed to any culture (Arabic, Deutsch, French, etc.) by defining the locale value and translation object.

Locale key words Text to display
Zoom Zoom
ZoomIn ZoomIn
ZoomOut ZoomOut
Reset Reset
Pan Pan
ResetZoom Reset Zoom

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

For more information about localization, refer to localization

Copied to clipboard
@using Syncfusion.EJ2.Maps;
@using Syncfusion.EJ2;
<div id="control-section">
    <ejs-maps id="maps" locale="ar-AR">
        <e-maps-zoomsettings enable="true"></e-maps-zoomsettings>
            <e-maps-layer shapeData="ViewBag.usmap">

        'ar-AR': {
            'maps': {
                ZoomIn: 'تكبير',
                ZoomOut: 'تصغير',
                Zoom: 'زوم',
                Pan: 'مقلاة',
                Reset: 'إعادة تعيين'
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
    public class HomeController : Controller
        public IActionResult Index()
            ViewBag.usmap = GetUSMap();
            ViewBag.electionData = GetElectionData();
            return View();
        public object GetUSMap()
            string allText = System.IO.File.ReadAllText("./wwwroot/scripts/MapsData/usMap.js");
            return JsonConvert.DeserializeObject(allText);
        public object GetElectionData()
            string text = System.IO.File.ReadAllText("./wwwroot/scripts/MapsData/electiondata.js");
            return JsonConvert.DeserializeObject(text);