Choosing localization for the ASP MVC Designer

Stimulsoft Reports.WEB discussion
Post Reply
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Choosing localization for the ASP MVC Designer

Post by kgb2013 »

Hello.

Is there a way to select in my view the initial localization of the Reports Designer?
I see there is a `LocalizationDirectory` property, but nothing specific that may help me select a language when the designer gets loaded.
It seems that it is searching for the "en.xml" by default.

I found out that I can choose a localization in the GetLocalization() action, but I don't think I can distinquise the user-requests for language-change from the automated ones when the designer first loads.
I want both the user to be able to change the language and set the initial defalt language myself on the server.
Can I do that?

Thanks,
Kostas
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Choosing localization for the ASP MVC Designer

Post by HighAley »

Hello.

To let users to change localization you should set next property:

Code: Select all

LocalizationDirectory = Server.MapPath("~/Content/Localization/")
You could also read how to localize Designer from code on the next article on the Stimulsoft User Manual.

Thank you.
kgb2013
Posts: 85
Joined: Fri Nov 01, 2013 9:52 am
Location: Earth

Re: Choosing localization for the ASP MVC Designer

Post by kgb2013 »

Hello.

I know about GetLocalization(), but I don't know how/if I can understand from within GetLocalization() if the request comes form the user deciding to change the language or from the designer initialization.
Here is my code:

Code: Select all

		public ActionResult GetLocalization()
		{
			// Load the localization file requested by the designer
			string name = StiMvcDesigner.GetLocalizationName(this.Request);
			string path = Server.MapPath("~/Content/ReportsModule/ReportsLocalization/");
			if(!System.IO.File.Exists(Path.Combine(path, name)))
			{
				var ci = Thread.CurrentThread.CurrentCulture;
				name = ci.Name + ".xml";
			}
			return StiMvcDesigner.GetLocalizationResult(Path.Combine(path, name));
		}
As far as I see, `StiMvcDesigner.GetLocalizationName(this.Request)` always return non-null.
So, I can't understand if I should use my default culture or the one provided by it.
Perhaps there is a way to specify the default localization returned by GetLocalizationName ?

Basically, I try to combine the two controller actions given in your documentation:
http://www.stimulsoft.com/en/documentat ... signer.htm
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Choosing localization for the ASP MVC Designer

Post by Vladimir »

Hello,

We have added a new Localization property, which allows you to force a default localization. Update will be available in the next prerelease build this week.

Thank you.
Post Reply