Globalization Questions

Stimulsoft Reports.NET discussion
Post Reply
fphealthcare
Posts: 33
Joined: Sun Jul 02, 2006 6:06 pm
Location: New Zealand

Globalization Questions

Post by fphealthcare »

I have looked over the Globalized Report sample but still have a few questions.
Firstly how to actually make the report localizable. From the sample I'm assuming you give the text a name in the GlobalizedName property. And that will get loaded by the GlobalizationManager - if this is the case this is fine.

My first question is I can't find where the different flags get loaded in the sample. Where / how are the flags loaded with the localized flag?

My second question is what is the 'GlobalizationStrings' property and how is it used?

Thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Globalization Questions

Post by Vital »

I have looked over the Globalized Report sample but still have a few questions.
Firstly how to actually make the report localizable. From the sample I'm assuming you give the text a name in the GlobalizedName property. And that will get loaded by the GlobalizationManager - if this is the case this is fine.

My first question is I can't find where the different flags get loaded in the sample. Where / how are the flags loaded with the localized flag?
1. You need override method GetImageGlobalizedNames:

Code: Select all

public string[] GetImageGlobalizedNames()
		{
			return new string[]
				{
					"Flag"
				};
		} 
This method return names of allowed images.

2. You need override method GetObject:

Code: Select all

public object GetObject(string name)
		{
			return nativeManager.GetObject(name, Culture);
		}
This method returns object (image) with specified name. In our case we get image from resources.
My second question is what is the 'GlobalizationStrings' property and how is it used?
This is second way for localizing report. You can specify translation of all words in report with special editor.

Thank you.

fphealthcare
Posts: 33
Joined: Sun Jul 02, 2006 6:06 pm
Location: New Zealand

Globalization Questions

Post by fphealthcare »

We have implemented Globalization using GlobalizationManager.cs from your Globalization example.

We have a Globalization class which is just a copy of the same class from the Globalization example

Code: Select all

public class GlobalizationManager : IStiGlobalizationManager
Then in the constructor of our report we have

Code: Select all

report.AutoLocalizeReportOnRun = true;

//Set globalization
reportFile.GlobalizationManager = new GlobalizationManager("FPH.PerfMax.Globals.LocalStrings", CultureInfo.CurrentCulture);
This work but has 2 problems for us. It works by actually loading the values we want from the resx file and updates the report accordingly.

The first problem (not really a problem) is that we noticed it loads the values twice. Once when the GlobalizationManager is created, and again when the report is shown - is this normal and expected?

The second problem is that we are using a culture invariant resx file. We have 'strings.en.resx'. Our culture is 'en-NZ', so we'd expect that the 'strings.en.resx' file is loaded, but instead the default 'strings.resx' file is loaded. Are we doing something wrong?

Thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Globalization Questions

Post by Vital »

The first problem (not really a problem) is that we noticed it loads the values twice. Once when the GlobalizationManager is created, and again when the report is shown - is this normal and expected?
That s normal.
The second problem is that we are using a culture invariant resx file. We have 'strings.en.resx'. Our culture is 'en-NZ', so we'd expect that the 'strings.en.resx' file is loaded, but instead the default 'strings.resx' file is loaded. Are we doing something wrong?
With Globalization manager you can use any method for localizing. Class "GlobalizationManager" is only sample. Using of resx file is sample too. You can use any way for returning correct string for provided string key.

Thank you.
fphealthcare
Posts: 33
Joined: Sun Jul 02, 2006 6:06 pm
Location: New Zealand

Globalization Questions

Post by fphealthcare »

Vital wrote:
With Globalization manager you can use any method for localizing. Class "GlobalizationManager" is only sample. Using of resx file is sample too. You can use any way for returning correct string for provided string key.

Thank you.
We are currently using a resx file for localizing our application (GUI, Forms, etc), so using the same resx file for the report is the best choice for us. We use a ResouceManager to load the resx file based on an invariant culture. So we have a 'strings.en.resx', a 'strings.fr.resx', and a 'strings.de.resx' files. If we are in 'en-NZ' culture, we would expect the ResourceManager to load the 'strings.en.resx' file, which it does. However when we create a GlobalizationManager for the report with the same resx files using the 'en-NZ' culture, it always seems to want to load the 'strings.en-NZ.resx' file or the 'strings.resx' file. Is it possible to have it load the invariant resx file? For example, we want it to load the 'stirngs.en.resx' file for all the 'en-XX' cultures.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Globalization Questions

Post by Vital »

Please use small method:

Code: Select all

public CultureInfo GetCulture(string cultureName)
{
  if (cultureName.Length > 2)cultureName = cultureName.Substring(0, 2);
  return new CultureInfo(cultureName);
}
Thank you.
Post Reply