This is a migrated thread and some comments may be shown as answers.

Localize breadcrumb items

9 Answers 223 Views
Breadcrumb
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Veteran
Jason asked on 23 Apr 2020, 03:24 PM

Hi,

Does anyone have a working project that demonstrates how to localize the breadcrumb component?

I have the breadcrumb working by parsing a hidden field for a property in the model populated in the controller.

 

@(Html.Kendo().Breadcrumb()
    .Name("breadcrumb")
    .Navigational(true)
    .RootIcon("home")
    .Value(Model.Breadcrumb)
)

 

It all works perfectly.  Except now, I need to localize the string values displayed in the breadcrumbs.  And of course, not disturb the the generated URL mapping to still make the links navigational to the desired controller/action.

Is this even possible using the breadcrumb component?

Thanks

Jason

 

 

 

 

 

 

9 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 28 Apr 2020, 12:59 PM

Hello Jason,

The items of the BreadCrumb are built dynamically, thus there is no available option that customizes the generated links. What I would suggest is to try and localize the supplied Model value through DataAnnotations or any of the alternative approaches that are described in the below article:

I hope this helps.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jason
Top achievements
Rank 1
Veteran
answered on 28 Apr 2020, 02:02 PM

Thanks for the reply Dimitar.

I already have decorated the controller actions with route attributes, in English.  In order to use any sort of annotations would mean decorating the controller actions with routes in every language we want to support.  It is possible but a maintenance nightmare.

 

[Route("/Human Resources/Employees", Order = 5)]
[Route("/Employee/Index", Order = 1)]
[HttpGet]
[Authorize]

 

If you have a enhancement request list for your breadcrumb component, localization would be a great addition and improvement for it.  A key/value pair would be simple to build dynamically, like you said.  For now, I'll have to write my own.

Thanks.

Jason

 

0
Jason
Top achievements
Rank 1
Veteran
answered on 28 Apr 2020, 02:40 PM
Or give us access to the creation of the link anchor for the breadcrumb items and let us define the href & title values.
0
Dimitar
Telerik team
answered on 29 Apr 2020, 05:01 AM

Hello Jason,

Actually you could control what the Breadcrumb renders for href and title through the Items collection as demonstrated in the following demo:

In this way, you could specify the text of the items based on the preferred language.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jason
Top achievements
Rank 1
Veteran
answered on 05 May 2020, 04:39 PM

Hi Dimitar,

I'm clearly misunderstanding your breadcrumb component.  The demo implementation is very simplistic and would require the breadcrumb component to be added to every page where we wanted to display breadcrumbs.  Correct?

I'm currently using a simple string field in the model using the .Value(Model.Breadcrumb) option to allow it to be generic and created in the controller.  

The sample demo you've provided is all hard coded values for each page.

Do you have a working demo project with a couple of pages to show the correct implementation of the breadcrumb component?

Thanks.

Jason

 

 

0
Dimitar
Telerik team
answered on 07 May 2020, 05:41 AM

Hi Jason,

The Items collection gives access to defining the text and link of each Breadcrumb item and allows to manually build the collection. I have posted the demo as an example and continuation of the last response where you mentioned that you would like to have access to the creation of the link anchor.

In terms of adding the Breadcrumb on every page - this depends on the project requirements. In general, the component could be rendered in the _Layout.cshtml of the application if you would like to have a single initialization.

As for a demo, you could observe the different rendering options in the official demos:

The third option that you currently have is to bind the Breadcrumb through the Value() option similar to the examples you have provided earlier.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jason
Top achievements
Rank 1
Veteran
answered on 21 May 2020, 12:39 AM

Thanks Dimitar.

I've decided to abandon the notion of localizing the Breadcrumb component with it's current capabilities.  It's simply too labour intensive to manually wire up and maintain long term with multiple languages.  Manually building the Breadcrumb component on every page is simply too cumbersome and not feasible on a large, complicated platform.

 

Hopefully, Telerik will upgrade the Breadcrumb component soon with some additional capabilities to address the current shortcomings and not rely on having to manually build the Breadcrumb component on every page.

 

Thanks for you assistance.

Jason

 

0
Dimitar
Telerik team
answered on 21 May 2020, 06:31 AM

Hello Jason,

I have logged a new Feature Request on your behalf for the Breadcrumb for providing a configuration option that would enable localizing the items through a dictionary. You can start tracking it from the following item:

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jason
Top achievements
Rank 1
Veteran
answered on 21 May 2020, 12:57 PM

Thanks Dimitar.  That would be an awesome feature...at least for us.  I'll be watching this feature request.

Thanks for your support.  Much appreciated.

 

Tags
Breadcrumb
Asked by
Jason
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Jason
Top achievements
Rank 1
Veteran
Share this question
or