Yaml (yml) file gotchas – trying to set default culture to “no”

The yaml file parser will attempt to parse all the values, rather than taking them as they are – which in most cases is a good thing, however you must remember to use quotes when the intended output is a string, and the parser may interpret the value otherwise:

default_culture:   en
// No problem, en is treated as a string 
// and /en/ is automatically added to links
 
default_culture: no
// Oops, no is translated by Symfony 
// the same way as false, 0 or off, giving it a boolean value!
 
default_culture: 'no'
// That's better, now you will have the intended results.

The same applies to any yml files that you may have “keywords” in, so try to always use quotes round everything that is not boolean, integer, etc.

2 Comments so far

  1. […] Yaml (yml) file gotchas – trying to set default culture to “no” […]

  2. […] public links >> yaml Yaml (yml) file gotchas – trying to set default culture to “no” First saved by pinkbowser | 2 days […]

Leave a reply