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

Localization in rad calendar

10 Answers 191 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Karthik Ulaganathan
Top achievements
Rank 1
Karthik Ulaganathan asked on 22 Nov 2011, 03:36 AM
Hi 1) we are in the development phase of localizing our application and we use the telerik rad controls for Ajax in most of our pages ... In this phase we have to support 5 languages (English, Japanese, French, portugese And German). We are using our customized resource files for all the asp.net controls and even for few telerik controls like RAdgrid .. How about radcalendar ? Which is the best way to localize radcalendar ? Does it allow custom resourcefile creation? We don find any property for Jan feb mar etc ... And also for the fast navigation controls (ok cancel today) or the month headers .. can u please guide us with the best possible way ? 2) same way even for the other rad controls can u let us know how many languages do u actually support ? We want to make sure that if we use the inbuilt radcontrol resource files all he 5 languages I mentioned above are supported and also in future too it should be expandable ... Thanks, Karthik

10 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Nov 2011, 05:46 AM
Hello Karthik,

Check the following code library which explains the same.
Local resources for RadGrid, RadCalendar and RadInput

-Shinu.
0
Karthik Ulaganathan
Top achievements
Rank 1
answered on 22 Dec 2011, 06:17 PM
Hi,
 
     We tried the examples given in the Telerik site for RadCalendar and implemented Localization for the same successfully. But, it works only for the Culture \ CultureInfo properties (like "en-US", "fr-FR") for both RadScheduler and RadCalendar. But, in our application we are using only "CurrentUICulture", which has the value of only neutral culture (like en, fr etc ...) . When this is assigned to the RadCalendar, we are getting the following error:

Message: Culture 'fr' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.
Stack trace:
   at System.Globalization.

CultureInfo.CheckNeutral(CultureInfo culture)
   at System.Globalization.CultureInfo.get_DateTimeFormat()
   at Telerik.Web.UI.Scheduler.Views.Month.RendererBase.CreateNavigationPane(Control container)
   at Telerik.Web.UI.Scheduler.Views.Month.Renderer.GetContent()
   at Telerik.Web.UI.RadScheduler.CreateContent()
   at Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource)
   at System.Web.UI.Control.EnsureChildControls()
   at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)
   at Telerik.Web.ChildControlHelper.FindControlRecursive(String ID, Control root)
   at Telerik.Web.ChildControlHelper.FindControlRecursive(String ID, Control root)
   at Telerik.Web.ChildControlHelper.FindControlRecursive(String ID, Control root)
   at Telerik.Web.UI.RadAjaxControl.OnPagePreRender(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


But, as per the information given in the link below, the 'CultureInfo' property should also support the two letter ISO Language names like "en" or "fr" etc ..  
     http://www.telerik.com/help/aspnet-ajax/p_telerik_web_ui_radcalendar_cultureinfo.html

Can you please let us know a solution for this ? How can we assign the 'CurrentUICulture' (TwoLetterISOLanguage Name) value to the 'RadCalendar' control, which has only the 'CultureInfo' property ?

Thanks & Regards,
Karthik.





0
Pavlina
Telerik team
answered on 22 Dec 2011, 10:55 PM
Hi,

The problem is that a Thread's culture can not be neutral. It must be specific like en-US or fr-FR. For more information on the matter you can refer to the link below:
http://www.socalmp.com/blog/template_permalink.asp?id=98

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Pavlina
Telerik team
answered on 23 Dec 2011, 11:52 AM
Hi,

Additionally, you can try using CultureInfo.CreateSpecificCulture method, which accepts neutral culture and see if it helps. This method maps a neutral culture to the associated default specific culture, and then creates a CultureInfo object that represents that specific culture. Please refer to the msdn link below for additional information:
http://msdn.microsoft.com/en-us/library/se513yha.aspx

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
ANDREW
Top achievements
Rank 1
answered on 03 Feb 2012, 05:43 AM
Hi Pavlina & Karthik,

I have found the same problem.. I have been setting the current thread's CurrentUICulture to a neutral culture and NOT setting the thread's CurrentCulture (leaving it as the default which for me is en-US) and it seems that the RadScheduler is ignoring what the CurrentCulture CultureInfo is and just forcing the CurrentUICulture over the top of it?! This doesn't seem right!!

A possible solution is to use the CultureInfo.CreateSpecificCulture function as you suggest and set it to the CurrentUICulture but this potentially will cause problems if there are multiple translations for different variants of the neutral culture and clobber the neutral translations.

Is there a reason that the RadScheduler is forcing the CurrentUICulture over the top of the CurrentCulture setting?

Thanks,

Andrew
0
Peter
Telerik team
answered on 08 Feb 2012, 12:33 PM
Hello Andrew,

You could experience such problem with RadScheduler if you use Web Service binding. In this case, please follow the suggestion from this help topic.

All the best,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
ANDREW
Top achievements
Rank 1
answered on 09 Feb 2012, 04:31 AM
Hi Peter,

Unfortunately this is not the case. I am just using a regular datasource for binding.

To demonstrate this problem something like this should do it:

protected override void InitializeCulture()
{
    base.InitializeCulture();
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
}

Note that it does not set the CurrentCulture property however the RadScheduler will complain that "fr" is not a specific culture (which is perfectly fine for setting the UI culture but not the thread culture.

Cheers,

Andrew
0
Peter
Telerik team
answered on 14 Feb 2012, 09:52 AM
Hi Andrew,

I tested your code, but it didn't give any problems - http://screencast.com/t/WMTYHb0IGjw. Please, let me know if I am missing something.


All the best,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
ANDREW
Top achievements
Rank 1
answered on 15 Feb 2012, 05:22 AM
Hi Steve,

A couple of things..

I've looked at your video but was a little confused. You set the CurrentUICulture although given you don't have the french translation for the scheduler in your project the strings aren't localised. However, as you point out in the video, the dates etc ARE localised. This suggests that you are setting the CurrentCulture somewhere else (and setting it to a french specific culture such as fr-FR) OR maybe you've got your computer's locale set to fr-FR or similar.

Also, you appear to be changing the CurrentUICulture in the Page_Load which I believe is incorrect. Should it not be done in the InitializeCulture?

In any case, I relooked at this on my end by modifying one of the example scheduler projects but was not able to reproduce the problem. What confuses me is that if I were to try set the CurrentCulture to a non-specific culture it would throw an exception there and then, not wait until it was in the bowels of the Scheduler create code (as per the stack trace from the exception I am getting):

[NotSupportedException: Culture 'fr' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.]
   System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) +7484386
   System.Globalization.CultureInfo.get_DateTimeFormat() +28
   System.Globalization.DateTimeFormatInfo.GetInstance(IFormatProvider provider) +87
   System.DateTime.ToString(String format, IFormatProvider provider) +23
   Telerik.Web.UI.Scheduler.Views.Month.RendererBase.CreateNavigationPane(Control container) +158
   Telerik.Web.UI.Scheduler.Views.Month.Renderer.GetContent() +88
   Telerik.Web.UI.RadScheduler.CreateContent() +218
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +195
   Telerik.Web.UI.RadScheduler.CreateChildControls() +34
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

From the call stack, it suggests that there is a call to DateTime.ToString(string, IFormatProvider) in Telerik.Web.UI.Scheduler.Views.Month.RendererBase.CreateNavigationPane that is using the Thread.CurrentThread.CurrentUICulture instead of the CurrentCulture?
 
I will continue to try and distinguish the difference between my project and the modified sample and let you know if I find anything.

Cheers,

Andrew
0
Peter
Telerik team
answered on 17 Feb 2012, 01:50 PM
Hi Andrew,

Thank you for sharing your findings.

Setting the Culture property of RadScheduler or the current thread culture will localize only some strings on RadScheduler. For the rest of them you should use the approach outlined in this help topic -
http://www.telerik.com/help/aspnet-ajax/scheduler-localization-translating-strings.html

Regards,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Calendar
Asked by
Karthik Ulaganathan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Karthik Ulaganathan
Top achievements
Rank 1
Pavlina
Telerik team
ANDREW
Top achievements
Rank 1
Peter
Telerik team
Share this question
or