Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Good evening.
A following question:
- When the method for Ajax request, it does not automatically detect the language of the site and choose the required resource :(
1. There are two resources Resources.resx (English) and Resources.ru.resx(Russian).
2. Form the form data is sent to the AA method.
3. Method AA () form comes with model letters consist of the following fields:
public class MyModel{public string Name { get; set; } public string Email { get; set; } public string Phone { get; set; } public string Message { get; set; } public string[] ListToEmail { get; set; } public HttpPostedFileBase File { get; set; }}
4. The letter normally send all but user information is sent only in Russian from a resource file.
public class AjaxController : SurfaceController { public ActionResult AA()
{ var nodes = CurrentPage.ContentSet.ToArray(); var model = new MyModelView(nodes[1]); return PartialView(model); } [HttpPost] public JsonResult AA(MyModel model) { try { //action return Json(new { Message = Resources.Resources.mail_success;, Success = true }, JsonRequestBehavior.AllowGet); } catch (Exception) { return Json(new { Message = Resources.Resources.mail_error, Success = false }, JsonRequestBehavior.AllowGet); } }
How to make the right conclusions from the information resource file?
There is an idea to do so:
[HttpPost] public JsonResult AA(MyModel model) { var langId= umbraco.library.GetCurrentDomains(6085)[0].Language; try { //action var message = ""; switch (langId.id) { case 1: message = Resources.EnResources.mail_success; break; case 2: message = Resources.RuResources.mail_success; break; } return Json(new { Message = message, Success = true }, JsonRequestBehavior.AllowGet); } catch (Exception) { .... }
but as I understand it is very ugly method :(
Thanks in advance!:)
p.s. Sorry for bad english
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Working with resource files for multilingual sites
Good evening.
A following question:
- When the method for Ajax request, it does not automatically detect the language of the site and choose the required resource :(
1. There are two resources Resources.resx (English) and Resources.ru.resx(Russian).
2. Form the form data is sent to the AA method.
3. Method AA () form comes with model letters consist of the following fields:
4. The letter normally send all but user information is sent only in Russian from a resource file.
How to make the right conclusions from the information resource file?
There is an idea to do so:
but as I understand it is very ugly method :(
Thanks in advance!:)
p.s. Sorry for bad english
is working on a reply...