I've upgraded to Umbraco 7.2 for the new corporate website build which needs to be in both Welsh and English. I really need my model attributes to be bilinqual and even though in early versions of Umbraco 7 there are various solutions that work, this is no longer the case.
Getting a little desperate on this now. Really liked Warren Buckleys solution which previously worked but doesn't in the latest versions?
Really appreciate any help on this one before my computer goes through the window
Hmm, have you tried pinging either Lee or Warren on Twitter to hear if they have any clue about what could be the issue and how it can be worked around maybe?
I know Warren was going to look at the issue but he's been so busy. I forked is code today and 80% through putting a fix in and will be making a pull request on monday with the updates :)
I'm not sure what changed in the core but when I was stepping through the source code, the attribute contstructor was only running once on application start. This meant if I refreshed the app pool and navigated to the english site all worked. If I then clicked to view the welsh site it still showed the english attribute values.
Again, if i refreshed the app pool and viewed the welsh content all worked fine until i switched languages and tried to view the english content. Personally i feel with the big push on razor and mvc this is something that should really be in the core.
Through investigation I noticed there were other solutions but Warren's custom attribute project was the most elegant really and gave more control, so it will be good to get this up and running again.
Hi Ismail, I did come across your solution and even though part of it worked on the new versions of 7 it run into the same problems that Warren's solution did.
I can't quite remember how far I got with your solution but it worked in the earlier versions of 7 just like Warren's but something changed in the newer versions of 7.
Sorry I'm a little vague now on the detail but I was looking at various solutions at the time.
Okay for me this isn't working. I've added the UmbracoValidationAttributes package to my solution and added a reference to it in my site. Now however, when I build or try to run the overall solution it won't compile because it says namespaces and references are missing in the UmbracoValidationAttributes project. Any ideas?
Okay I can confirm that this definitely is not working. I have now tried importing the files for this into my App_Code folder and setting each file to compile.
I then rebuild my solution. After doing so I create a dictionary item to be used called:
Validation.Required
I then decorate my model with the following:
public class TourInstanceSelection
{
[UmbracoRequired("Validation.Required")]
public int? InstanceId { get; set; }
}
The message I set in the back office for this language is :
I'm currently still working on our corporate site. I've just checked and its 7.2.4 and all is working fine.
I've complied the dll and its in the bin folder but your example above is working fine with me. Send me your email address and I will email you the dll and source I'm using if its any different?
So you are just dropping the compiled.dll of the project into your overall solution and not referencing the project? Doesn't this play hell with your dependencies? Is there any way I can just reference the project by adding it into my solution? I am using version 7.2.4.
The other potential issue (although it shouldn't be) is my model is inheriting from RenderModel.
Umbraco Validation Attributes
I've upgraded to Umbraco 7.2 for the new corporate website build which needs to be in both Welsh and English. I really need my model attributes to be bilinqual and even though in early versions of Umbraco 7 there are various solutions that work, this is no longer the case.
Getting a little desperate on this now. Really liked Warren Buckleys solution which previously worked but doesn't in the latest versions?
Really appreciate any help on this one before my computer goes through the window
Hi Craig
Not quite sure I get the context - Can you provide a link to the way Warren does it?
/Jan
Hi Jan,
http://creativewebspecialist.co.uk/2014/04/17/umbraco-mvc-regionalisation-of-error-messages/
https://github.com/warrenbuckley/Umbraco-Validation-Attributes/commits/master
This previously worked in earlier versions of 7, but I think it stopped from about 7.1.8 or newer.
Hi Craig
Hmm, have you tried pinging either Lee or Warren on Twitter to hear if they have any clue about what could be the issue and how it can be worked around maybe?
/Jan
I know Warren was going to look at the issue but he's been so busy. I forked is code today and 80% through putting a fix in and will be making a pull request on monday with the updates :)
Thanks Jan
Hi Craig
Ah, awesome! That's the spirit :)
So now I'm curious... what's the issue? What changed after 7.1.8 release?
/Jan
Hi Jan,
I'm not sure what changed in the core but when I was stepping through the source code, the attribute contstructor was only running once on application start. This meant if I refreshed the app pool and navigated to the english site all worked. If I then clicked to view the welsh site it still showed the english attribute values.
Again, if i refreshed the app pool and viewed the welsh content all worked fine until i switched languages and tried to view the english content. Personally i feel with the big push on razor and mvc this is something that should really be in the core.
Through investigation I noticed there were other solutions but Warren's custom attribute project was the most elegant really and gave more control, so it will be good to get this up and running again.
So just so I am aware, is this working again now or is your pull request still waiting to be merged into the overall project?
Bit late to party I did one a while ago https://github.com/ismailmayat/MvcUmbracoDataAnnotations its v7 but you could update the umbraco stuff to v7 using nuget ??
Regards
Ismail
Hi Jason,
Yes all should be working again now. I made a pull request a couple of weeks ago and as far as I know its been merged :)
I have it running locally on 7.2.* and all working fine.
Hi Ismail, I did come across your solution and even though part of it worked on the new versions of 7 it run into the same problems that Warren's solution did.
I can't quite remember how far I got with your solution but it worked in the earlier versions of 7 just like Warren's but something changed in the newer versions of 7.
Sorry I'm a little vague now on the detail but I was looking at various solutions at the time.
Okay for me this isn't working. I've added the UmbracoValidationAttributes package to my solution and added a reference to it in my site. Now however, when I build or try to run the overall solution it won't compile because it says namespaces and references are missing in the UmbracoValidationAttributes project. Any ideas?
Okay I can confirm that this definitely is not working. I have now tried importing the files for this into my App_Code folder and setting each file to compile.
I then rebuild my solution. After doing so I create a dictionary item to be used called:
I then decorate my model with the following:
The message I set in the back office for this language is :
Instead, the error message I am getting is:
Hi Jason,
I'm currently still working on our corporate site. I've just checked and its 7.2.4 and all is working fine.
I've complied the dll and its in the bin folder but your example above is working fine with me. Send me your email address and I will email you the dll and source I'm using if its any different?
So you are just dropping the compiled.dll of the project into your overall solution and not referencing the project? Doesn't this play hell with your dependencies? Is there any way I can just reference the project by adding it into my solution? I am using version 7.2.4.
The other potential issue (although it shouldn't be) is my model is inheriting from RenderModel.
My Email is [email protected]. Thanks for your help btw.
is working on a reply...