Page 1 of 1

Choosing localization for the ASP MVC Designer

Posted: Thu Jan 16, 2014 11:58 am
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

Re: Choosing localization for the ASP MVC Designer

Posted: Fri Jan 17, 2014 11:52 am
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.

Re: Choosing localization for the ASP MVC Designer

Posted: Fri Jan 17, 2014 3:19 pm
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

Re: Choosing localization for the ASP MVC Designer

Posted: Mon Jan 20, 2014 2:08 pm
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.