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

Customize scheduler (text)

2 Answers 167 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Veteran
Iron
Stefan asked on 24 Nov 2020, 03:36 PM

Hi everybody,

is there a way to set all labels of scheduler component by code? I need a scheduler where the whole text should be changeable independent from current culture (buttons, date and time strings,...)

Thx, Stefan

2 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 27 Nov 2020, 09:11 AM

Hello,

In the current implementation the only way to change strings is through the ITelerikStringLocalizer interface. This affects all telerik components. So you can define a custom service that implements this interface, and returns strings on some other factor, rather than culture. However this will affect all telerik components, not just the scheduler.

using Telerik.Blazor.Services;

public class SampleResxLocalizer : ITelerikStringLocalizer
{
    // this is the indexer you must implement
    public string this[string name]
    {
        get
        {
            return GetStringFromResource(name);
        }
    }

    // sample implementation - uses .resx files in the ~/Resources folder named TelerikMessages.<culture-locale>.resx
    // You can get the values from anywhere you need however
    public string GetStringFromResource(string key)
    {
        return Resources.TelerikMessages.ResourceManager.GetString(key, Resources.TelerikMessages.Culture); ;
    }
}

Regards,
Bozhidar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Stefan
Top achievements
Rank 1
Veteran
Iron
answered on 02 Dec 2020, 12:02 PM

Hi Bozhidar,

thx for your answer. Indeed: I modified my own translation service by implementing ITelerikStringLocalizer interface and it works as you described.

Thank you for your support!

Regards,

Stefan

Tags
Scheduler
Asked by
Stefan
Top achievements
Rank 1
Veteran
Iron
Answers by
Bozhidar
Telerik team
Stefan
Top achievements
Rank 1
Veteran
Iron
Share this question
or