I want to leave a value in my .yaml field empty, because in another translation there has to be something but not in this one. Just leaving it empty prints out the path of the value (...title.3).
title:
1: String
2: String2
3:
I want to leave a value in my .yaml field empty, because in another translation there has to be something but not in this one. Just leaving it empty prints out the path of the value (...title.3).
title:
1: String
2: String2
3:
You can use ~
or null
.
You should read documentation of YAML and you can read Symfony Yaml Format as well
title:
1: String
2: String2
3: ~
<h4> {{ '....title.1'|trans }}<sup>7</sup> {{ '...title.2'|trans }}<sup>2</sup> {{ '...title.3'|trans }}
–
Childhood ..title[3]
–
Caphaitien If you want an empty string, rather than a null value, you can use two single quotes.
title:
1: String
2: String2
3: ''
According to YAML v1.2 spec:
10.3.2. Tag Resolution
Regular expression Resolved to tag null | Null | NULL | ~ tag:yaml.org,2002:null /* Empty */ tag:yaml.org,2002:null
So putting null
or ~
or omitting value produces the same result: tag:yaml.org,2002:null
:
parent:
key1: # empty so "null", # is a comment!
key2: ~ # also "null"
key3: null # "null" explicitly ))
key4: !!null "null" # for the funs of "secondary tag handle: !!"
key5: "null" # sorry, it is a string or !!str if you like ((
© 2022 - 2025 — McMap. All rights reserved.
null
or~
), so the problem is not in your YAML. You should edit your question to include all of the relevant code and add the relevant tags. – Carinacarinate