Copied to clipboard

Flag this post as spam?

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


  • McGern 13 posts 44 karma points
    Mar 16, 2024 @ 15:02
    McGern
    0

    Content Delivery Api can't get fallback language working

    Hi,

    I've started using the content delivery api and I don't know whether I am doing something wrong, or if this isn't a feature yet, but I'm really struggling with the Umbraco fallback language concept and why it's all setup in the admin UI when you seem to have to manually code for it? e.g.

    publishedContent.Value<string>("myProp", culture, fallback: Fallback.ToDefaultLanguage)
    

    I had somewhat assumed that the internal content fetching mechanisms would handle things like this automatically?

    My actual query is for the content delivery api (v13.2) where the fallback language doesn't seem to be picking up at all and there is no obvious place to code a fallback because the content fetching is abstracted.

    I was trying with a vanilla fresh install with a simple setup to see if it was something wrong with my actual project.

    • Two languages setup, "en" and "es". "en" is set as default and fallback in the admin UI
    • Created a doc type with both invariant and variant properties
    • Filled in the props for the default language
    • Published the second language with the variant prop populated and tested without it being populated

    This is what I am seeing

    • Requesting api with default language worked as expected
    • When requesting the second language (via Accept-language or language specific path)
      • any invariant field values pulled through
      • Variant field values that that were populated pulled through
      • Variant field value for non-populated fields appeared as null, not even empty string.

    Not sure if I'm missing some config setting in the Delivery Api documentation, can anyone confirm that it's working correctly for them?

    Thanks very much, Jarrod

    (p.s. I posted a similar question on the end of a different question about a similar topic, so apologies)

Please Sign in or register to post replies

Write your reply to:

Draft