How do I declare a string with both single and double quotes in YAML?

前端 未结 3 1396
北海茫月
北海茫月 2020-12-10 10:39

I\'m internationalizing an application and cannot figure out how to declare a translation string that contains both single and double quotes. Here\'s an example of the en.ym

3条回答
  •  长情又很酷
    2020-12-10 10:53

    See if this works for you, it works perfectly for me in my spring boot applications where I needed to pass JSON values in:

    Using YAML pipe style:

    app.json:
      values: |
        {"key": "value"}
    

    Your case would be:

    en:
      my_string: |
        When you're using double quotes, they look like "this"
    

    Folded style might work too but I haven't tried.

    See more here: http://symfony.com/doc/current/components/yaml/yaml_format.html#strings

提交回复
热议问题