What is @Model in your example? If it's an IPublishedContent then yes, you should be able to get a specific language by passing in the ISO code to the GetVortoValue method.
Could you explain what exactly is going wrong in your example?
Hmm, it might be worth checking what the website thinks is the current culture. Maybe try outputting the current culture via @(System.Globalization.CultureInfo.CurrentCulture.Name) and see if it matches "da-DK" given that that is the only culture you have a value for.
Regarding 1.1 and 1.2 that might just be me forgetting to update the version number in the DLL, I'll double check that, but I don't think that will affect you here.
Also, maybe try outputting @System.Threading.Thread.CurrentThread.CurrentUICulture.Name as this is actually what Vorto uses to detect the current culture (it should be the same as the last one though, but worth checking).
I've got it up an running and I think I see what the problem is now. You seem to be using the old RazorMacroEngine rather than the newer MVC Partials macro engine which is what you'd need to use with Vorto (or just plain old Partials would work fine too).
I'd probably suggest you take a look at the umbraco docs regarding how the new partials view engine works aswell as some tips for converting your old code to the newer view engine:
You shouldn't need to switch everything. If you stick with using Macros, the docs say you can use partial view macros with webforms too. It does mean you'd have to change your old razor macros to the new partial macros though.
If you see the docs page here (http://our.umbraco.org/documentation/reference/templating/macros/) you'll see that the older macro engine has been deprecated, hence why Vorto doesn't support it.
TL;DR - You don't have to update EVERYTHING, but you will need to update your macros.
get value by language
Hi,
Shouldnt i be able to do this, where is my language code eg. da-DK or en-US.
I am using webforms and 7.1.4
Hi Peter,
What is
@Model
in your example? If it's anIPublishedContent
then yes, you should be able to get a specific language by passing in the ISO code to the GetVortoValue method.Could you explain what exactly is going wrong in your example?
Many thanks
Mat
Hi,
Model is the current page like always.
My set so far is pretty simple, should work.
My hostnames are setup correctly,.
Calling Model.GetPropertyValue("bodyTitle")
returns:
{"values":{"da-DK":"yutyrgdcvx z"},"dtdGuid":"c17be0c9-8dc2-43c7-bd06-6373db8f8e0b"}
Hi Peter,
Ok, then you'll need to change it to be:
The
HasVortoValue
andGetVortoValue
extension methods only work on anIPublishedContent
entity, which in a standard razor view is at@Model.Content
.Hope this helps
Matt
PS Also make sure you have the Vorto using statement at the top of you view (before the
@inherits
bit)@using Our.Umbraco.Vorto.Extensions;
Many thanks
Matt
Hi,
It dosnt make a difference, i already tried that earlier.
I am trying this now. No value returned, No errors in console. Nothing in the log.
Upps,
and putting the Vorto using statement at the very top dosnt make a difference.
Under installed packages i get version number 1.1
But here when you download Vorto it says 1.2
I added the vorto yester today.
But can that be it??
Hmm, it might be worth checking what the website thinks is the current culture. Maybe try outputting the current culture via
@(System.Globalization.CultureInfo.CurrentCulture.Name)
and see if it matches "da-DK" given that that is the only culture you have a value for.Matt
Regarding 1.1 and 1.2 that might just be me forgetting to update the version number in the DLL, I'll double check that, but I don't think that will affect you here.
Hi,
I tried installing Vorto on different solution. Now the version number says 1.2, but to no avail. Still i dont see any data.
Outputting @(System.Globalization.CultureInfo.CurrentCulture.Name) gives me the correct culture, as expected.
Damn, this package is so sweet, just what i need.
Hi Peter,
What do you get if you just output
@Model.Content.GetVortoValue("bodyText", "da-DK")
? (no if statement)Matt
Also, maybe try outputting
@System.Threading.Thread.CurrentThread.CurrentUICulture.Name
as this is actually what Vorto uses to detect the current culture (it should be the same as the last one though, but worth checking).Hi,
Tried these, without any luck.
@Model.Content.GetVortoValue("bodyText", "da-DK")
@Model.Content.GetVortoValue("bodyText", "da-DK").Value
I also tried all this on a different solution, same prob.
Outputting @System.Threading.Thread.CurrentThread.CurrentUICulture.Name also gives the correct culture.
Take a peek: http://cartendo.dk/forhandlere-vaerksteder
Hmmm, very interesting. Out of interest, what Data Type are you wrapping with Vorto? (couldn't find that dtdGuid in the Umbraco source).
The only thing I could think to do is either a) for you to download the source from github and debug through these extension methods to see what is going on https://github.com/mattbrailsford/Vorto/blob/master/Src/Our.Umbraco.Vorto/Extensions/IPublishedContentExtensions.cs or b) if you could zip up your install including DB and I could try and replicate your install.
Let me know if either one of those are an option. I can't really see from the code here why it shouldn't be working for you.
Many thanks
Matt
Hi,
Here is a zip: http://www.pcl.dk/projects/justty/VORTO_TEST_UMB714.rar
And thanks for your help.
Hi Peter,
I've got it up an running and I think I see what the problem is now. You seem to be using the old RazorMacroEngine rather than the newer MVC Partials macro engine which is what you'd need to use with Vorto (or just plain old Partials would work fine too).
I'd probably suggest you take a look at the umbraco docs regarding how the new partials view engine works aswell as some tips for converting your old code to the newer view engine:
http://our.umbraco.org/documentation/Reference/Templating/Macros/Partial-View-Macros/
Have a read of that, and see if it makes any sense.
Many thanks
Matt
So i need to change the entire solution to using MVC?
You shouldn't need to switch everything. If you stick with using Macros, the docs say you can use partial view macros with webforms too. It does mean you'd have to change your old razor macros to the new partial macros though.
If you see the docs page here (http://our.umbraco.org/documentation/reference/templating/macros/) you'll see that the older macro engine has been deprecated, hence why Vorto doesn't support it.
TL;DR - You don't have to update EVERYTHING, but you will need to update your macros.
Many thanks
Matt
YES YES, you are right.
It works, fantastic.
You are the best. YUHUUU.
Sweeet!
Glad you got it working :)
Many thanks
Matt
is working on a reply...