Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3338
globalizationa nd locaization issues..
posted

Folks I recently ran into this issue and came up with a solution..

the text of the emails to and from tech support are included. For issues dealing with localization of the webgrid, this may help.

Note: I have many webpages with different webgrids.. this one sub, takes care of all the caption text for all the pages.

Read from the bottom up..

   ______________________________________________________________________

Yeah, It seems there are a million ways to do this stuff.

I have come up with a scenario that works quit well.

I do use the tool in vs2008 : Generate Local Resource to take care of resource string assignment. IT works quite well, and by simply changing the language of the browser it works well with different resx files..

Becuase using this method WIPES OUT everything between <band> and </band>, I copy the existing data structure before using the MS tool. then paste the asp code back in.

For changing the column header captions, on the fly, I have come up with the following:

Using a global.resx file for source..

call this methid with your data grid name, this method sits in a vb file inthe app data section of the website.

Private Sub setupDataGrid(ByVal GridName As UltraWebGrid)

Dim i As Integer = 0

For i = 0 To GridName.Columns.Count - 1

Select Case UCase(GridName.Columns(i).Key.ToString)

Case Is = "AssetID"

GridName.Columns(i).Header.Caption = Resources.Global1.grdAssetID

Case Is = "hdate"

GridName.Columns(i).Header.Caption = Resources.Global1.grdhDate

Case Is = "HStatus"

GridName.Columns(i).Header.Caption = Resources.Global1.grdFullName

Case Is = "CurrentID"

GridName.Columns(i).Header.Caption = Resources.Global1.grdCurrentID

Case Is = "username"

GridName.Columns(i).Header.Caption = Resources.Global1.grdusername

Case Is = "signatureid"

GridName.Columns(i).Header.Caption = Resources.Global1.grdsignatureid

Case Is = "imageid"

GridName.Columns(i).Header.Caption = Resources.Global1.grdimageid

Case Is = "SigImage"

GridName.Columns(i).Header.Caption = Resources.Global1.grdSigImage

Case Is = "PhotoImage"

GridName.Columns(i).Header.Caption = Resources.Global1.grdPhotoImage

End Select

The code reads the key name and gets the global resource version of it and assigns it. THisis done after a datasource and databind.

This method works perfectly, without error.

By having different global.resx files like Global.ru-RU.resx, etc... it will always replace the caption with theone in the file, and if it can't find it it uses the caption in the Global.resx, and if it can't find that then it uses the the text in the

<Header Caption="Your caption here" >

 

this works very well.. Another note, when using the datagrid and genereating the local resource file for the grid, it creates  resource file entries for all the filter condition words.. ex: like, contains, startswith etc... you can create a different language variant of that resx file and it WILL pick up the reource file entries..

 

Very cool, all in all.

________________________________________________________

Hello Daryl ,

Thanks for getting back to me.

Please do correct me from the issue description it seems that you want to use the globalization with your sample application i.e. you want to develop a website in which users can choose the language they want the site to be in.

If above mentioned is your scenario, you can achieve the required functionality/behavior by using Satellite Assembly and for this you have to do your own custom coding by using the help from online help articles:

<http://msdn.microsoft.com/en-us/library/21a15yht(VS.71).aspx>

<http://www.codeproject.com/KB/aspnet/SatelliteAssemblies.aspx>

Please test the above given links and I hope this will help you to achieve the desired functionality.

 _________________________________________________________________

based upon your response, does thatt mean the only way to localize the captions and such is to do it in the code behind?  If a column header says "Name" I want to be able to change that if someone with a different language uses the software, say French for instance.

How would I do that? I would have to read a text from a resource file, wouldn't i?

__________________________________________ 

Hello Daryl,

Thank you for submitting your issue with Infragistics Developer support.

From the description of the issue it seems that you want to localize the WebGrid.

The WebGrid does not handle any localization, and it relies mainly on the culture of the current thread to determine how to format culture specific data. If you wanted to specify a specific static culture you could do this in your WebConfig file or in code in your Page Load event:

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture
    ("en-GB")

If you wanted to localize the application for each user dynamically, you could additionally use the Request object to retrieve the current request's culture:

System.Threading.Thread.CurrentThread.CurrentCulture =

 System.Globalization.CultureInfo.CreateSpecificCulture
    (Request.UserLanguages[0])

This will dynamically localize the control format and language.

Hope this helps.

Please let me know if you need further assistance on this issue.

Sincerely,

Developer Support Engineer

_______________________________________________________________________

Summary

Bug in grid using resx files and localization

Description

When using local resources files.

If you add;

 

meta:resourcekey="UltraGridColumnResource1.Header.Caption"

TO

<igtbl:UltraGridColumn BaseColumnName="fullname" Key="fullname" Width="200px">

<Header Caption="Name" >

</Header>

</igtbl:UltraGridColumn>

 

you get an error: "Generation of designer failed: The 'Header' tag cannot have a meta:resourcekey attribute."

 

There is also an issue where the MS tool: Create local resource file wipes out the grid data

removes everything between <band> </band>  including the key word <band>

The second problem I can do a workaround for. But I must be able to localize the column headers for different languages.

 

Steps to Reproduce

Create a webpage with a grid, set up some columns, then use MS tool: create local resource file.