[Solved]: Do I need quotes for strings in YAML?



Problem Statement:

I am trying to write a YAML dictionary for internationalization of a Rails project. I am a little confused though, as in some files I see strings in double quotes and in some without. A few points to consider:

  • example 1 – all strings use double quotes;
  • example 2 – no strings (except the last two) use quotes;

My question is – what are the rules for using the different types of quotes in YAML. Could it be said that:

  • in general, you don’t need quotes;
  • if you want to escape characters use double quotes;
  • use ! with single quotes, when… ?!?

Thank you.


Solution: