How to localize SLViewer?

Stimulsoft Reports.Silverlight discussion
Locked
JaSioo
Posts: 7
Joined: Wed Jul 27, 2011 7:39 am

How to localize SLViewer?

Post by JaSioo »

There is much about localizing designer, but I couldn't find any info about SLViewer. Please help.
I did some code, but nothing worked:

StiLocalization.Language = "Polish";
StiLocalization.CultureName = "pl";
StiLocalization.Description = "Polski";
StiLocalization.DirectoryLocalization = "\\Resources\\Localization\\PrintLocals\\";
StiLocalization.Localization = "pl.xml";
viewer.Localize();
Anton Lozovskiy
Posts: 135
Joined: Tue Aug 11, 2009 9:38 am

How to localize SLViewer?

Post by Anton Lozovskiy »

Hello,

Please use the following code:

System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
Stimulsoft.Report.StiConfig.LoadLocalization(asm, "SilverlightApplication1.Localization.pl.xml");
Stimulsoft.Base.Localization.StiLocalization.Load(Stimulsoft.Report.StiConfig.Localizations[0]);

Thank you.
JaSioo
Posts: 7
Joined: Wed Jul 27, 2011 7:39 am

How to localize SLViewer?

Post by JaSioo »

Hi,

I used your code and it seems I'm doing somthing wrong...
It throws an exception:

{System.ArgumentNullException: Value cannot be null.
Nazwa parametru: stream
w System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
w System.IO.StreamReader..ctor(Stream stream)
w Stimulsoft.Report.StiConfig.LoadLocalization(Assembly asm, String nameOfResource)
w THBZasoby.Views.Printing.PrintPreviewWindow..ctor(String repName, IPrintingService service)}

My code now is:

public PrintPreviewWindow(string repName, IPrintingService service)
:this()
{
Service = service;
Title = repName;
//StiLocalization.Language = "Polish";
//StiLocalization.CultureName = "pl";
//StiLocalization.Description = "Polski";
//StiLocalization.DirectoryLocalization = "\\Resources\\Localization\\PrintLocals\\";
//StiLocalization.Localization = "pl.xml";
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
Stimulsoft.Report.StiConfig.LoadLocalization(asm, "THBZasoby.Localization.pl.xml"); < <<<< = = = = Here it throws an exception
Stimulsoft.Base.Localization.StiLocalization.Load(Stimulsoft.Report.StiConfig.Localizations[0]);
//StiLocalization.Localization = "pl";
viewer.Localize();
//viewer.Localization = "pl";
}

Thank you.

[Edit:] I'm using version: 2011.1 of Reports.Silverlight
JaSioo
Posts: 7
Joined: Wed Jul 27, 2011 7:39 am

How to localize SLViewer?

Post by JaSioo »

OK. I've managed that using your code :)

The path was a bit different and the localize file needed to be compiled as embedded resource.

Thanks.
Anton Lozovskiy
Posts: 135
Joined: Tue Aug 11, 2009 9:38 am

How to localize SLViewer?

Post by Anton Lozovskiy »

Hello,

Let us know if you need any additional help.

Thank you.
Locked