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

Possible IsLocalizationLanguageRespected="False" Bug ?

6 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Richard asked on 12 Apr 2013, 11:00 AM
I have a RadGrid with a number columns some of which are dates and I need them to display in UK format i.e. dd/mm/yyyy
I set the language for the application as per your help page
Dispatcher.BeginInvoke(() => Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name));

This works for all of the RadGridViews in my application, except for grids that are nested inside of a RadGridView.RowDetailsTemplate 
Nested grids still show dates in american format i.e. mm/dd/yyyy 

I have tried setting the IsLocalizationLanguageRespected="False" on the parent and the nested grid but nothing seems to work. 
Right now I have to use the dataformat string to have my dates display correctly but I'd rather this came from the current culture. 

Is this a problem with IsLocalizationLanguageRespected property or am I missing something ?

Thanks Richard

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Apr 2013, 02:33 PM
Hello Richard,

I have tried to reproduce the behavior, but without much success. Could you take a look at the sample attached and let me know whether I am missing something ?
Considering IsLocalizationLanguageRespected, if  you set it to false, you will not need the dispatcher and Language property setter. 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 12 Apr 2013, 03:10 PM
Thanks for taking the time to look at this Maya. I tried your demo project and it worked as expected, the dates displayed in the correct UK format. So I went back to my application and sure enough the dates are still showing as american in the nested table.

However! there is something different in my project. The table was in a popup RadWindow, I tired adding the XmlLanguage initialisation code the RadWindow's constructor and it started to work, the dates are showing in the correct UK format. 

The nested table was a red herring it's not nested tables that have the issue, that's where I noticed it first, any table in a RadWindow has the problem. 

Is this expected behavior and is there way to have all my RadWindow's use the language/culture set in the MainPage.xmal automatically ? I have a lot or RadWindow's and would prefer if I didn't have to update each one with those lines of code but if I have to I will.

Thanks
Richard
0
Konstantina
Telerik team
answered on 17 Apr 2013, 11:53 AM
Hi Richard,

In order to set the culture to all windows, you will have to set it to the whole application. So, you should put these lines of code in App.xaml.cs:

Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-GB");

Hope this helps.

All the best,
Konstantina
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 17 Apr 2013, 01:06 PM
Hi Konstantina ,

I'm afraid that doesn't do it either. The problem is I have lots of grids over lots of windows and I'd like to set the all to UK date from a few lines of global settings code. 

If I use:
Dispatcher.BeginInvoke(() => Language = XmlLanguage.GetLanguage("en-GB")); in Main.cs

1) All grids in the main application display the date in UK format. Good
2) All grids in RadWindows / Popups display the grid in US format. Bad
Fix: Add Dispatcher.BeginInvoke(() => .... to all RadWindows

If I use:
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-GB");

1) All grids in the application still show the date as US format. Bad
Fix: Edit the grid properties, for every grid to set IsLocalizationLanguageRespected="False"
They would all work but that's a huge amount of work. 

So the question comes down to, as the grid is set to IsLocalizationLanguageRespected="True" by default,
Is there away of globally setting the Language for the application to "en-GB" ?
Or, globally setting default grid property to IsLocalizationLanguageRespected="False"?
I have tired setting the Language in App.cs but it's not a Framework Element and has no such property.

Thanks 
Richard

0
Accepted
Konstantina
Telerik team
answered on 22 Apr 2013, 11:06 AM
Hello Richard,

In order to apply the IsLocalizationLanguageRespected property to all Grids you could create a global style and set the property there. Please find attached a sample project in which this is illustrated. Also, the global culture is set to the Thread in App.xaml.cs

Hope this helps.

All the best,
Konstantina
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 22 Apr 2013, 04:23 PM
Hi Konstantina

Thanks for the demo code, that makes sense to me.

Cheers,
Richard 

Tags
GridView
Asked by
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Maya
Telerik team
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Konstantina
Telerik team
Share this question
or