Put several item states with conditions and with text in a single component

Hello all, I am creating a widget with just the oh-label-card component and as configuration just label and in this label I would like to put some text like this for instance (in french) : Sébastien(props.firstname) à été localisé(e)(depend on props.kind) la dernière fois à 16H(item[props.lastseen].state)
But adding a condition (for props.kind) does not work and gives me the following error message: Nested mappings are not allowed in compact mappings

Do you have any solutions to my problem knowing that I can use other components since I just want text with different props.something and conditions?

Here is my code:

uid: texte_localisation
  - localisation
    - label: Prénom
      name: firstname
      required: true
      type: TEXT
    - description: Tapez FEM si le texte doit être affiché au féminin sinon laissez vide
      label: Genre
      name: kind
      required: false
      type: TEXT
      advanced: true
    - context: item
      label: Dernière localisation envoyée
      name: lastseen
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Mar 26, 2022, 10:31:49 AM
component: oh-label-card
  label: =(props.firstname) + " a été " + props.kind  === "FEM" ? "localisée" : "localisé" + "la dernière fois à " + items[props.lastseen].state

Thanks in advance.

This error means that the yaml parser doesn’t allow a : in a value because : is the character that it understands to separate keys and values. To get a : it has to be within a string. So, any time you want to use one of these ternary expressions, you have to put the whole expression (including the =) inside another, different, layer of quotes, like this:

key: '=(test value) ? "test is true" : "test is false"'

First of all, thank you for your quick answer… But I try to put quotes, parentheses, both at the same time, nothing helps. I still have the same error :sob: :sob: !

You use double quotes for all the strings, so you need to encase the whole thing in single quotes (that’s what I was trying to get at when I unhelpfully just said “different quotes”). As for parentheses, you are best off using them to separate out the conditional, but nothing else in this statement requires them if I am understading what you’ve got. I would format it something like this:

label: '=props.firstname + " a été " + ((props.kind  === "FEM") ? "localisée" : "localisé") + "la dernière fois à " + items[props.lastseen].state'

Great !!! That’s exactly what I wanted! It works perfectly! Thank you very very much !! Good evening.