Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Luke Hook 45 posts 175 karma points c-trib
    Nov 13, 2019 @ 21:34
    Luke Hook
    0

    Retrieving alternative variant culture content from specified culture code

    Hi guys,

    I have a site with multiple variant cultures. For the sake of example we have the default site "en-GB" and an american alternative "en-US".

    We show some pricing for various items on site. I'd like to be able to use variant cultures to display an alternative US price for a specific value.

    I've set the language, and created the variant in the CMS. All working ok. If I preview the content within Umbraco I can see the differing content.

    In my razor view, I'm trying to get the alternative content using the following code (as specified in the Documentation)

    @Model.Value("price", "en-US", fallback: Fallback.ToLanguage)
    

    However this doesn't return the value, instead only displaying the fallback.

    Am I missing something, or is this functionality not actually possible like the docs imply? Do I need to set the culture in my surface controller for example?

    Thanks, Luke

Please Sign in or register to post replies

Write your reply to:

Draft