Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    May 09, 2015 @ 12:33
    Jason Espin
    0

    Multi-lingual select inputs on front end

    Hi all,

    Is there any way within Umbraco we can setup a multi-select list on the Umbraco front-end that changes depending on which language is used?

    For example, we have a search field on our site that contains the following fields and options

    <Date From>
    <Date To>
    <Trip Type>
      [These are created from Umbraco pages]
    </Trip Type>
    <Trip Difficulty>
      <Easy />
      <Moderate />
      <Hard />
      <Challenging />
    </Trip Difficulty>
    <Trip Duration>
      <2 - 5 days />
      <6 - 10 days />
      <11 + days />
    </TripDuration>
    

    At the moment we have two languages and therefore two homepage nodes in our project. The easy thing to do would be to create a page for each of the options (Easy etc) and store it within the relevant site but this means creating unnecessary nodes and could also effect SEO so in my eyes this would be bad practice as they will never be pages.

    The only other option I can see is creating a set of dictionary items for each of the options like so:

    difficulty1 difficulty2 difficulty3 difficulty4 etc..

    Within these would obviously be the labels for the selects. I could first collect all of the dictionary items with a for loop that increments the number by 1 each time to check whether a dictionary item with that number exists. If so, then I add that name to a list:

    • difficulty1
    • difficulty2 etc.

    I could then check that each of the dictionary values in my list contains an actual value and is not blank. If it is, then I remove it from my list.

    I then iterate through the final list outputting the dictionary values that are retrieved which then gives me my dictionary items as select options.

    The problem with this is my select options need to be keyvalue pairs as when an option is selected it's label will be easy but it's actual value for matching in the search index will be 1. I could store the values in JSON or XML in my dictionary but that isn't very friendly for the end users who will be adding content to the site or maybe changing these options in the future so does anyone have any ideas how I might get around this?

    Ideally if I could, I would retrieve these options from properties in the search page document type but as far as I am aware there is no property type that allows you to enter key value pairs in this way.

    Any help with this rather complex issue would be greatly appreciated.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 09, 2015 @ 14:10
    Dennis Aaen
    0

    Hi Jason,

    Could you perhaps use the Vorto package for this https://our.umbraco.org/projects/backoffice-extensions/vorto the package is a multilingual property by allowing you to enter multiple values per language enabled on the site.

    Matt Brailsford the creator of this package has done a demo on the uHangout show, you can see the video here: https://www.youtube.com/watch?v=fC-Xhj1HnnU

    Hope this could be a option for you, to solve your case.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft