Input (sample.en.yml
)
---
sample:
plural-key:
# This is a sample pluralisation key.
zero: "There are no monkeys"
one: "There is one monkey"
two: "There are two monkeys"
other: "There are {num} monkeys"
regular-key: "There are a bunch of monkeys" # This is a sample for a regular key.
Preprocess YAML to convert comments to ...___phrase_description
keys entries:
cat sample.en.yml \
| php -R 'echo preg_replace("/^((\s*\S+)\s*:.*)#(.*)$/","\\1\n\\2___phrase_description: \"\\3\"",
preg_replace("/^(\s*)#([^#]+)$/","\\1___phrase_description: \"\\2\"",$argn))."\n";'
Output:
---
sample:
plural-key:
___phrase_description: " This is a sample pluralisation key."
zero: "There are no monkeys"
one: "There is one monkey"
two: "There are two monkeys"
other: "There are {num} monkeys"
regular-key: "There are a bunch of monkeys"
regular-key___phrase_description: " This is a sample for a regular key."