Page 1 of 1

How to localize SLViewer?

Posted: Wed Jul 27, 2011 7:42 am
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();

How to localize SLViewer?

Posted: Thu Jul 28, 2011 12:27 am
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.

How to localize SLViewer?

Posted: Thu Jul 28, 2011 4:21 am
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

How to localize SLViewer?

Posted: Thu Jul 28, 2011 5:08 am
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.

How to localize SLViewer?

Posted: Fri Jul 29, 2011 12:09 am
by Anton Lozovskiy
Hello,

Let us know if you need any additional help.

Thank you.