When I go to route /Directory/Users/Managers it will show entries: Directory, Users, Managers. Is there a way to localize them to my language?
1 Answer, 1 is accepted
1
Accepted
Vasko
Telerik team
answered on 05 Sep 2023, 11:51 AM
Hello,
In order to make the Breadcrumb Items text display in your language (or whatever language you want), you'll have to check what is the selected language culture of your application on the server:
In the Controller that loads the current View, create some ViewBag string variables that hold the desired Breadcrumb item text, you can use if ... else or switch() statements to check what the current selected culture is(here I'm using Spanish and English for example):
using Kendo.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespacebreadcrumb.Controllers
{
publicclassHomeController : Controller
{
public IActionResult Index()
{
if (/*! Check for a specific language culture */)
{
ViewBag.item1Text = "Hola";ViewBag.item2Text = "Amigo";
}
elseif (/*! Check for another specific language culture */)
{
ViewBag.item1Text = "Hi";ViewBag.item2Text = "Friend";
}
return View();
}
}
}
In the given View, use the ViewBag.item1Text, ViewBag.item2Text in the Breadcrumb (in this example, my given View is the Index page):
This approach will work with whatever language culture you set in the if () statement to be checked. I hope this response is helpful. Feel free to contact us again if more questions arise.
Kind regards,
Vasko
Progress Telerik
Stay tuned by visiting our public roadmap and feedback portalpages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.