Umbraco7 Unobtrusive validation for multiple languages
Hello All,
We are trying for unobtrusive validations for multiple languages. But it always gives one language for all countries. Example result mentioned in step 5 which supposed to be two different languages i.e Danish and Swedish. But it always shows Danish language. The process which we have followed mentioned in below. Can someone help us where did we make mistake?
1.Creating Dictionary files in Umbraco:
2.Updating Dictionary Based on Country Wise:
3.Updating Dictionary Name
4.Updating same name which we have created in Dictionary same name as Updating in Model.
Ok, the hostnames are setup correctly so must be something in the code.
Would it be possible if you just share a snippet showing what the code looks like for just the firstname part? It's not that I don't want your e-mail but if you share it here others can see the code as well and come with their input and suggestions, which increases the chances that you'll get the issue solved faster and smarter - Who knows...I might not even be able to figure it out so it's clearly an advantage that more people can see the code.
public sealed class UmbracoDisplayAttribute : DisplayNameAttribute
{
public UmbracoDisplayAttribute(string dictionaryKey)
: base(dictionaryKey)
{
}
public override string DisplayName
{
get
{
return umbraco.library.GetDictionaryItem(base.DisplayName);
}
}
}
Controller Action:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using UmbracoTest;
using Umbraco.Web.Mvc;
using Test.Business.Models;
namespace UmbracoTest.Controllers
{
public class TestSurfaceController:SurfaceController
{
public ActionResult NewUser()
{
return View();
}
[HttpPost]
public ActionResult NewUser(Registration registration)
{
if (ModelState.IsValid)
{
return View("NewConfirmation");
}
else
{
return View();
}
}
}
Umbraco7 Unobtrusive validation for multiple languages
Hello All,
We are trying for unobtrusive validations for multiple languages. But it always gives one language for all countries. Example result mentioned in step 5 which supposed to be two different languages i.e Danish and Swedish. But it always shows Danish language. The process which we have followed mentioned in below. Can someone help us where did we make mistake?
1.Creating Dictionary files in Umbraco:
2.Updating Dictionary Based on Country Wise:
3.Updating Dictionary Name
4.Updating same name which we have created in Dictionary same name as Updating in Model.
5.Result :
Hi Mastan
Am I right assuming that the label fields are fetched from the dictionary item as well?
If so then it's really odd. Could you perhaps show all of the code? What exact version of Umbraco 7 are you using?
I also assume that there has been setup different hostnames for the sites?
/Jan
Thanks Jan. Here are my comments for your questions.
2 Umbraco Version 7.1.8
Hi Mastan
Ok, the hostnames are setup correctly so must be something in the code.
Would it be possible if you just share a snippet showing what the code looks like for just the firstname part? It's not that I don't want your e-mail but if you share it here others can see the code as well and come with their input and suggestions, which increases the chances that you'll get the issue solved faster and smarter - Who knows...I might not even be able to figure it out so it's clearly an advantage that more people can see the code.
/Jan
Hi Jan,
We have ready with complete database and Source code can you please tell me how can i share my code.
Thanks Mastan
HI Jan, Here is our code.
using System; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Web;
using Umbraco.Web.Mvc;
using System.ComponentModel;
using UmbracoValidationAttributes;
namespace Test.Business.Models { public partial class Registration {
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class UmbracoDisplayAttribute : DisplayNameAttribute { public UmbracoDisplayAttribute(string dictionaryKey) : base(dictionaryKey) { }
}
Controller Action:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using UmbracoTest; using Umbraco.Web.Mvc; using Test.Business.Models;
namespace UmbracoTest.Controllers { public class TestSurfaceController:SurfaceController {
}
View Code:
@@model ShopUSAMob.Data.Bussiness.Models.user;@ @inherits Umbraco.Web.Mvc.UmbracoViewPage
}
Kindly let me know if you want any thing else.
Thanks Mastan.
Hi Jana,
Can you Please suggest how to work on Unobtrusive validation for multiple languages.
Hi Jana, can you please suggest how to work on the unobtrusive validation for multiple languages. We are waiting for your reply
is working on a reply...