v8: PublishedContentExtensions.Value helper returns no value for invariant property when culture is passed in
See original GitHub issueWhen calling model.Value("propAlias", culture:"en-US")
on a property where the given property is culture invariant, no value is returned.
I think there should be one of two things possible here
- Either return the invariant value for any passed in culture, as, being invariant means that value is what should be displayed for all languages
or
- Provide a fallback option that allows you to fallback to the invariant value if the property you have asked for is invariant but you try to access it via a culture variant means
The reason I require this is because I have some code that needs to try and access properties in a generic way. The code is passed a culture and property aliases, but it is not aware if any of the properties are culture specific and so there should be a way to access properties in a single generic way without having to know up front whether it is language variant or invariant. Currently, the only way to achieve this is to try and access the value passing the culture, but if the value is empty, try again this time with no culture.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
CultureInfo.InvariantCulture Property (System.Globalization)
This technique ensures that the underlying date and time values do not change when the data is read or written by users from...
Read more >Class PublishedContentWrapped | Umbraco c# Api docs
Remarks. Contains one IPublishedProperty for each property defined for the content type, including inherited properties. Some properties may have no value.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, that sounds good to me, we’ll have a chat at HQ and will let you know!
Personally I think it would be nicest to have a boolean on the property to see if it’s invariant or not, it seems easier to discover.
Hiya @mattbrailsford,
Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.
We will close this issue for now but we’re happy to open it up again if you think it’s still relevant (for example: it’s a feature request that’s not yet implemented, or it’s a bug that’s not yet been fixed).
To open it this issue up again, you can write
@umbrabot still relevant
in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it’s still relevant.For example:
This will reopen the issue in the next few hours.
Thanks, from your friendly Umbraco GitHub bot 🤖 🙂