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

Ability to set Culture application-wide?

33 Answers 981 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bseels
Top achievements
Rank 1
bseels asked on 28 Sep 2010, 09:00 PM
Based on localization documentation, to use a global resource file for a specific language, you must set the Culture property on the grid itself in each page.  We have over 80% of our pages and controls that contain RadGrids.  This is not feasible as the application's Culture is dynamic - selected by the user at login.

Is there a way to set the Culture for ALL grids in ONE place based on user-input? 

Thanks.

33 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 30 Sep 2010, 01:55 PM
Hi,

You can try setting a culture for the whole application depending on the language of the user's browser by using the CultureInfo.CreateSpecificCulture() method. You can find sample code and more explanations in this MSDN article on Resources in ASP.NET Pages. I hope this helps you achieve the desired effect.

Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 01 Oct 2010, 01:47 PM
A very similar question, how do we set the default culture application-wide without caring about any langange settings the user might have in their browsers? Ie, in this case, what culture should be used on a RadGrid, in case no culture is specified in the properties. I thought it would use the:

        <globalization culture="sv-SE" uiCulture="sv" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/>

But it doesnt seem like it.
0
Tsvetina
Telerik team
answered on 01 Oct 2010, 03:55 PM
Hi Patrik,

Yes, this is a correct way to set culture for the whole application. You may not notice its effect in RadGrid, as the control is highly customizable but if you put a RadCalendar on the page, you will see the change. 

However, if you want to localize the grid to use a language of your choice, you can achieve that by global resources. Here is a link to a help topic which deals with this approach.

Best wishes,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 01 Oct 2010, 04:02 PM
Well, just as the original poster of this thread, we don't want to set a culture on each grid on every page, but instead have a more flexible solution, like putting it into the web.config (after all, that is why it is in the web.config to begin with). The fact that RadCalendar support this is great, but it doesn't really help us unless RadGrid also supports all other features of the RadGrid, which I doubt :)

So, unless I missed something in your answer, it seems like my question still remain, how do you set the culture application wide so that the RadGrid (and other Telerik controls) use that as default? Thank you.

0
Tsvetina
Telerik team
answered on 04 Oct 2010, 12:19 PM
Hi Patrik,

Please, excuse me for misleading you. I checked again on this issue and actually, as of present, RadGrid does not support taking its culture from the globalization settings of an application (i.e. the <globalization> setting in web.config).
Currently, the only other way to set RadGrid's culture apart from declaratively is in code-behind by assigning the current application Culture to the control:
protected void Page_Init(object sender, EventArgs e)
 {
    RadGrid1.Culture = System.Threading.Thread.CurrentThread.CurrentCulture;
 }

In such case, if you have a few grids on one page, you will be able to traverse them and assign the desired Culture setting.

Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 05 Oct 2010, 12:31 PM
I have do admit that I find the actual support for localization in the Telerik components to be significant less than what we expected and what I think it should be. It seems to something "thrown something in here and there" rather than something based on a decision to actually support localization across the product line. This is a bit strange considering that as far as I know, you are yourself not a US company, the later which sometimes have a hard time realizing there is a non English speaking world out there. I have to be hones and say that this is something that sometimes has me thinking about alternatives, as good support for localization is important for us in many of our projects.

Sorry for the nagging, but better to be honest than "nice" I guess...
0
Tsvetina
Telerik team
answered on 08 Oct 2010, 02:20 PM
Hi Patrik,

Please, excuse us for the inconvenience caused by this limitation. As you can see in our release notes, localization is often mentioned, as we are still working on it for our controls.

There is another approach which I can suggest you, that might be more acceptable for you. That would be to create a theme for your application that would apply culture to all RadGrids in the page. This happens by adding a new Theme to the App_Themes folder of your project and creating a new .skin file in this theme, where this line is enough:
<telerik:RadGrid runat="server" Culture="bg-BG" />

Then you only need to set the Theme property in your Page tag:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Theme="Bulgarian" Inherits="Default" %>
(where Bulgarian is the name of the .skin file and Theme folder)

I am attaching a sample project demonstrating this approach.

Best wishes,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 17 Oct 2010, 10:45 PM
This sounds more like a workaround rather than a solution, but still it is a bit interesting. Not mainly due to localization issues, but due to the fact that it implies that you can implement "site unique" features in the skinfiles, which might be interesting for other reasons (like when trying to implement the changes required for Implementing Peter Blums Data Entriy Suite with RadGrids). Will have to look into this more, havn't had time at all so far to look into the skinning/theming of Telerik controls.

Another question more related to localization though, how come SOME of the texts used by RadGrid is still in the properties, when most others are in recource files? I'm thinking about stuff like the EditForm texts etc. Is there a way to control this using resource files as well? Having a localization system where you have to implement some stuff in a skin/theme, some in resource files and some in design time properties really isn't all that great, and a nightmare to maintain over time.
0
Tsvetina
Telerik team
answered on 20 Oct 2010, 03:44 PM
Hi Patrik,

In the current version of RadControls we have localized the most commonly used string texts. As I mentioned before, localization is still an ongoing process for RadControls which you will be able to see for yourself in our Q3 release - there the edit form texts (Edit, Insert, Update,Cancel) will be a part of the RadGrid localization.

Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 20 Oct 2010, 05:02 PM
Great news that it will be included in Q3 Release! Many thanks for this, it will be really helpfull. If you could also manage to put in an LocalizationPath for the RadGrid also, it would be even better :)

0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2010, 01:00 PM
What happened to the localization support promised for the Q3 release? According to the release note, the only change is:

"Added: RadGrid new localizable property: GridTableView.EditFormSettings.PopUpSettings.CloseButtonTooltip"

Which is better than nothing but perhaps a bit less than expected? :)
0
Tsvetina
Telerik team
answered on 11 Nov 2010, 01:19 PM
Hi Patrik,

If you still do not want to install the new version of RadControls, you can download the hotfix file and take a look at the resource files. You will see that the Update/Insert/Cancel texts which we discussed along with others, too, are added in there as promised.

Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2010, 01:25 PM
Ah, so it is just the release notes that is lacking some of the new functionality then? That is perhaps not optimal, since that is the purpose of having release notes, but still, much better than not having the new options included. Thanks!
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2010, 03:38 PM
Have tried this now and it works great, it might be a small change for you to make but it really helps when you are trying to build an international application. Many thanks for this! Now, if you could also add a "LocalizationPath" to the Grid, it would be even better :)
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2010, 04:15 PM
Unfortunately, it seems like you have forgotten to include the Text for "Select" button in this upgrade. Is it possible to add this manually to the resourcefile until you have had a chance to fix this in future releases, or does it require a code change on your side? It's a bit anoying as this seem to be the only button text missing now that you have included the rest.

Regardless, this should be considered a bug (or whatever you like to call it in your issue tracking system) I thinkg and it would be really nice if it could be included in the next maintenance release.

0
Tsvetina
Telerik team
answered on 11 Nov 2010, 04:29 PM
Hello Patrik,

Which Select button do you have in mind? If it is the link button in the server-side selection demo - this is not a built-in RadGrid selection column, so its button text cannot be a part of the localization file. Please, let me know if I am missing anything here.

As for the LocalizationPath, I forwarded your request to our developement team for further consideration if it will be included in future releases.

Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Nov 2010, 04:39 PM
Then you add this to a RadGrid:

        <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="column">
        </telerik:GridButtonColumn>

It will default to "Select" and only way to change that seem to be under the settings for each RadGrid, just as it was with Update, Insert etc. before the latest release. This would still force you to make hard-to-maintain customizations to each grid, instead of just editing a resourcefile.
0
Tsvetina
Telerik team
answered on 12 Nov 2010, 09:10 AM
Hi Patrik,

This is an arbitrary text in RadGrid, not a built-in one like that of the Update/Cancel/Insert/etc. buttons. It is just a GridButtonColumn, not a specifically designed one like the GridEditCommandColumn which text you can localize.

There is no built-in select command column, since its functionality is simple enough to achieve by just using a button or template column with a "Select" command name.

One more thing - our developement team confirmed that there will be a LocalizationPath for RadGrid in Q3 2010 SP1.

Best wishes,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 12 Nov 2010, 01:12 PM
Great news about the LocalizationPath! This will be very helpful for us trying to overcome the limitations in DotNetNuke regarding ASP.NET localization features.

Regarding the Selectbutton, even if it is a different kind of button compared to Edit etc. it would stil be nice to have that in the resourefile as well, as it is a "standard button". Originally we just had the "click the row to select" and no select button at all, but it seems this was confusing to our users.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 21 Jan 2011, 01:02 PM
Just checking, is there now a possibility to set an application wide culture that works with RadGrids (as discussed above)?

It would still be really nice if you could add the Select button to the resourcefile handling as well, now that you seem to have added the text for the other buttons.

Thank you!
0
Tsvetina
Telerik team
answered on 21 Jan 2011, 03:01 PM
Hello Patrik,

I tested it with the latest version of RadControls and now RadGrid takes the global culture set in the web.config file and in the Page declaration. 

As for the select button, I will forward this to our developers for further consideration.

Best wishes,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 21 Jan 2011, 03:15 PM
This is great news. However, we can't get it to work. We have in our web.config:

<globalization culture="sv-SE" uiCulture="sv-SE" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />

but unless we specify the culture of the RadGrid to "sv-se", it will load resource file RadGrid.Main.resx instead of RadGrid.Main.sv-se.resx

(We are using DotNetNuke but have removed the                 <!--<remove extension=".resx"/>--> from web.config)
0
Tsvetina
Telerik team
answered on 27 Jan 2011, 10:07 AM
Hello Patrik,

Does this happen when you use the LocalizationPath property to point to the right location for the resource files? Also, could you please cofnfirm if all other controls pick up their correct localization files?

Best wishes,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Adam Kochanowski
Top achievements
Rank 1
answered on 06 Jul 2012, 11:17 AM
Hi
I just wanted to let you know that apart from setting RadGrid's culture programmatically in code behind on every page, you can also set it in aspx just like that:

<telerik:RadGrid (...) Culture="<%# System.Globalization.CultureInfo.CurrentCulture %>"

I just created a snippet that I use every time i need a RadGrid on a page.
0
Michael
Top achievements
Rank 2
answered on 08 Oct 2014, 09:38 AM
We did it like Adam is suggesting. Unfortunately there was an issue when sorting via AJAX. When clicking on the column header the grid would lose the culture and display all filter possibilities in English.

We solved this by setting the culture in the code-behind file.
0
Konstantin Dikov
Telerik team
answered on 13 Oct 2014, 07:44 AM
Hello Krisztian,

With our latest versions, setting the culture globally for the application works as expected and RadGrid is retrieving that culture correctly.

Can you please try to set your culture globally for the application and see if the issue is resolved. 

I am looking forward to your reply.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Michael
Top achievements
Rank 2
answered on 13 Oct 2014, 08:14 AM
Hello Konstatntin. We are using the version named Telerik.Web.UI_2010_3_1215_Dev. I don't think that the feature you are suggesting is available in our version.

We already set the culture globally using the CurrentCulture and CurrentUICulture properties of the Thread class. RadGrid however needs extra handling. The only solution that is working is settings RadGrid's Culture in the code-behind file.
0
Konstantin Dikov
Telerik team
answered on 15 Oct 2014, 03:23 PM
Hi Krisztian,

I have tested the approach provided by Adam with your current version, where the culture is set within the web.config file globally for the application and the culture is set within the markup of the grid. Even when the grid is within an RadAjaxPanel, everything is working correctly:
<telerik:RadAjaxPanel runat="server">
    <telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource"
         AllowSorting="true" Culture="<%# System.Globalization.CultureInfo.CurrentCulture %>">
    </telerik:RadGrid>
</telerik:RadAjaxPanel>

And within the web.config:
<system.web>
<globalization culture="sv-SE" uiCulture="sv-SE"/>

Can you please confirm that you have tried that approach in your project?


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Michael
Top achievements
Rank 2
answered on 17 Oct 2014, 10:40 AM
Hello Konstantin,

I modified our .ascx file (that contains the RadGrid markup) and web.config file to include the attributes you posted. I also removed the following lines from the UserControl's OnInit method:

this.gridProdukte.Culture = System.Globalization.CultureInfo.GetCultureInfo(Lang.GetUserCultureFromCookie().Code);

The result is: the language of the filter menu switches back to English after the RadGrid is sorted by any of the columns.

It is then again fixed when I add the line into the OnInit method of the UserControl's code-behind file.
0
Konstantin Dikov
Telerik team
answered on 22 Oct 2014, 08:45 AM
Hello Krisztian,

It seems that you have a rather complex scenario and you are not setting your Culture globally for the entire application or for some reason you are setting it only on the initial page load. Please remove the globalization settings from your web.config file, keep your code for setting the CurrentCulture and CurrentUICulture for the Thread object and debug your application to see if the line where you are setting the Thread properties and the line where you are setting the grid Culture property are executed on each postback (and in what order).

I am looking forward to your reply with the results.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Michael
Top achievements
Rank 2
answered on 30 Oct 2014, 10:21 AM
Hello Konstantin,

I set up a breakpoint in the OnInit method of the UserControl containing the RadGrid and also one in the Application_BeginRequest handler that sets the culture on the Thread level. Each breakpoint is hit on every request. This includes normal and "AJAX" requests fired by sorting operations.

Kind regards,

Krisztian
0
Konstantin Dikov
Telerik team
answered on 03 Nov 2014, 01:44 PM
Hello Krisztian,

Since we can not replicate such behavior with the version that you are currently using on our side, the only thing that I could suggest is that you prepare a sample, runnable project replicating the issue and open a regular support ticket, so we can inspect this locally.

Once again, please consider upgrading to our latest version, where you could set the culture globally for the entire application and avoid those workarounds.



Best Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Michael
Top achievements
Rank 2
answered on 04 Nov 2014, 07:26 AM
Hello Konstantin,

i'll let it be. The project is sequentially rebuilt using ASP.NET MVC and kendo UI. So I also won't investigate the issue any further. Thank you for your help.

All the best,

Krisztian
Tags
Grid
Asked by
bseels
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
improwise
Top achievements
Rank 1
Iron
Iron
Adam Kochanowski
Top achievements
Rank 1
Michael
Top achievements
Rank 2
Konstantin Dikov
Telerik team
Share this question
or