Page 1 of 2
How to change default language Viewer
Posted: Thu Feb 16, 2017 7:52 pm
by lfcapacio
Hi,
How i can change default language a Viewer Report.JS ?
Thank you
Re: How to change default language Viewer
Posted: Thu Feb 16, 2017 8:55 pm
by Alex K.
Hello,
Use next commands to change language of viewer's GUI.
Add a new language to the Select UI language menu. The file is uploaded to a client when the language is selected.
Code: Select all
Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile("Localizations/pt-BR.xml", false, "Portuguese (Brazil)");
Add a new language to the Select UI language menu and set it as a current language.
Code: Select all
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("Localizations/es.xml");
Remove all languages from the Select UI language menu, upload it to a client and set it as a current language.
Code: Select all
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("Localizations/es.xml", true);
All these commands should be used before the viewer is created.
Thank you.
Re: How to change default language Viewer
Posted: Fri Feb 17, 2017 11:32 am
by lfcapacio
Hi,
It's work !
Thank you !
Re: How to change default language Viewer
Posted: Fri Feb 17, 2017 11:42 am
by Alex K.
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
Re: How to change default language Viewer
Posted: Sat Mar 18, 2017 3:27 am
by jcmmde
Can you help me get the language localization into the create viewer code? For example changing the viewer to Spanish or es.xml?
Code: Select all
function createViewer() {
// Specify necessary options for the viewer
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.height = "100%";
options.appearance.scrollbarsMode = true;
options.toolbar.showDesignButton = true;
options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct;
options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table;
options.toolbar.showAboutButton = false;
// Create an instance of the viewer
viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
// Add the design button event
viewer.onDesignReport = function (e) {
this.visible = false;
if (designer == null) createDesigner();
designer.visible = true;
designer.report = e.report;
};
viewer.renderHtml("viewerContent");
}
Re: How to change default language Viewer
Posted: Mon Mar 20, 2017 11:42 am
by HighAley
Hello.
You could load the localization files like in described in
the article from our Help Center.
Thank you.
Re: How to change default language Viewer
Posted: Mon Mar 20, 2017 11:54 pm
by jcmmde
I tried adding the following line;
Code: Select all
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("Localizations/es.xml");
at the start of my createViewer function. But then the viewer doesn't load, without this line it works fine, in English. I'm trying to run the web page Client Side only. Could this cause the problem? or perhaps I'm just not understanding how to code it correctly?
Thanks for your help and patience.
Re: How to change default language Viewer
Posted: Wed Mar 22, 2017 6:05 pm
by jcmmde
Debugging, running the web page locally. The code snippet;
Code: Select all
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localizations/es.xml");
Generates an error "Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource."
Which I believe is the browser security not wanting to let one file open up another file locally.
Perhaps there is another way for me to use localization for a client side web page?
Thanks
Re: How to change default language Viewer
Posted: Fri Mar 24, 2017 1:12 pm
by Alex K.
Hello,
We couldn't reproduce this bug.
Please send, show us all .html file for analysis.
Also, please try to check the last prerelease build.
Thank you.
Re: How to change default language Viewer
Posted: Fri Mar 24, 2017 3:17 pm
by jcmmde
I've been migrating my current application over using the download trial, before l purchase. When I test localization with the Demo.html file, I get the Cross Origin request.
Thanks for your help, last thing I need to get figured out.