BUG Fix yaml generation to conform to version 1.1, accepted by transifex

This commit is contained in:
Damian Mooyman 2015-03-10 13:42:22 +13:00
parent cf2089bc54
commit 622ad54c5b
2 changed files with 11 additions and 1 deletions

View File

@ -632,9 +632,13 @@ class i18nTextCollector_Writer_RailsYaml implements i18nTextCollector_Writer {
}
// Write YAML
$oldVersion = sfYaml::getSpecVersion();
sfYaml::setSpecVersion('1.1');
$yamlHandler = new sfYaml();
// TODO Dumper can't handle YAML comments, so the context information is currently discarded
return $yamlHandler->dump(array($locale => $entitiesNested), 99);
$result = $yamlHandler->dump(array($locale => $entitiesNested), 99);
sfYaml::setSpecVersion($oldVersion);
return $result;
}
}

View File

@ -417,6 +417,9 @@ PHP;
$entities = array(
'Level1.Level2.EntityName' => array('Text', 'Context'),
'Level1.OtherEntityName' => array('Other Text', 'Other Context'),
'Level1.BoolTest' => array('True'),
'Level1.FlagTest' => array('No'),
'Level1.TextTest' => array('Maybe')
);
$yaml = <<<YAML
de:
@ -424,6 +427,9 @@ de:
Level2:
EntityName: Text
OtherEntityName: 'Other Text'
BoolTest: 'True'
FlagTest: 'No'
TextTest: Maybe
YAML;
$this->assertEquals($yaml, Convert::nl2os($writer->getYaml($entities, 'de')));