yaml 的百分号(%) 解析出错


I'm getting an error with .yml translation file for symfony. Here is my file(date.it.yml).

diff.ago.year: un anno fa | %count% anni fa
diff.ago.month: un mese fa | %count% mesi fa
diff.ago.day: %count% giorno fa | %count% giorni fa
diff.ago.hour: un'ora fa | %count% ore fa
diff.ago.minute: 1 minuto fa | %count% minuti fa

Think this line gives me error. un anno fa | %count% anni fa.

This is my error,

Error parsing YAML, invalid file "C:\wamp64\www\swapp/translations\date.it.yml"

It would be great if someone can help. Thanks in advance.


% is invalid at the start of a plain string in YAML.

So this line:

diff.ago.day: %count% giorno fa | %count% giorni fa

is invalid and needs quotes:

diff.ago.day: '%count% giorno fa | %count% giorni fa'

Now if you had additionally a single quote inside of this string, you would double it. Or you could use double quotes.


全部评论: 0