Possible IsLocalizationLanguageRespected="False" Bug ?

7 posts, 1 answers
  1. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 12 Apr 2013 Link to this post

    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
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 12 Apr 2013 Link to this post

    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.

  3. DevCraft banner
  4. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 12 Apr 2013 Link to this post

    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
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 17 Apr 2013 Link to this post

    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.

  6. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 17 Apr 2013 Link to this post

    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

  7. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 22 Apr 2013 Link to this post

    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.

  8. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 22 Apr 2013 Link to this post

    Hi Konstantina

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

    Cheers,
    Richard 

Back to Top
DevCraft banner